[BACK]Return to find_path.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Diff for /src/usr.bin/sudo/Attic/find_path.c between version 1.4 and 1.5

version 1.4, 2002/04/25 15:49:03 version 1.5, 2003/03/15 21:23:54
Line 1 
Line 1 
 /*  /*
  * Copyright (c) 1996, 1998-2001 Todd C. Miller <Todd.Miller@courtesan.com>   * Copyright (c) 1996, 1998-2003 Todd C. Miller <Todd.Miller@courtesan.com>
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
Line 61 
Line 61 
 #include "sudo.h"  #include "sudo.h"
   
 #ifndef lint  #ifndef lint
 static const char rcsid[] = "$Sudo: find_path.c,v 1.98 2001/12/14 06:40:03 millert Exp $";  static const char rcsid[] = "$Sudo: find_path.c,v 1.101 2003/03/15 20:31:02 millert Exp $";
 #endif /* lint */  #endif /* lint */
   
 /*  /*
Line 82 
Line 82 
     char *origpath;             /* so we can free path later */      char *origpath;             /* so we can free path later */
     char *result = NULL;        /* result of path/file lookup */      char *result = NULL;        /* result of path/file lookup */
     int checkdot = 0;           /* check current dir? */      int checkdot = 0;           /* check current dir? */
       int len;                    /* length parameter */
   
     if (strlen(infile) >= MAXPATHLEN) {      if (strlen(infile) >= MAXPATHLEN) {
         (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile);          (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile);
Line 93 
Line 94 
      * there is no need to look at $PATH.       * there is no need to look at $PATH.
      */       */
     if (strchr(infile, '/')) {      if (strchr(infile, '/')) {
         (void) strcpy(command, infile);          strlcpy(command, infile, sizeof(command));      /* paranoia */
         if (sudo_goodpath(command)) {          if (sudo_goodpath(command)) {
             *outfile = command;              *outfile = command;
             return(FOUND);              return(FOUND);
Line 128 
Line 129 
         /*          /*
          * Resolve the path and exit the loop if found.           * Resolve the path and exit the loop if found.
          */           */
         if (strlen(path) + strlen(infile) + 1 >= MAXPATHLEN) {          len = snprintf(command, sizeof(command), "%s/%s", path, infile);
           if (len <= 0 || len >= sizeof(command)) {
             (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile);              (void) fprintf(stderr, "%s: path too long: %s\n", Argv[0], infile);
             exit(1);              exit(1);
         }          }
         (void) sprintf(command, "%s/%s", path, infile);  
         if ((result = sudo_goodpath(command)))          if ((result = sudo_goodpath(command)))
             break;              break;
   

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5