version 1.1.1.2, 2012/05/29 12:26:49
|
version 1.1.1.3, 2013/07/22 10:46:12
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 1996, 1998-2005, 2010-2011 | * Copyright (c) 1996, 1998-2005, 2010-2013 |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 22
|
Line 22
|
#include <config.h> |
#include <config.h> |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/param.h> |
|
#include <sys/stat.h> |
#include <sys/stat.h> |
#include <stdio.h> |
#include <stdio.h> |
#ifdef STDC_HEADERS |
#ifdef STDC_HEADERS |
Line 65 find_path(char *infile, char **outfile, struct stat *s
|
Line 64 find_path(char *infile, char **outfile, struct stat *s
|
int len; /* length parameter */ |
int len; /* length parameter */ |
debug_decl(find_path, SUDO_DEBUG_UTIL) |
debug_decl(find_path, SUDO_DEBUG_UTIL) |
|
|
if (strlen(infile) >= PATH_MAX) | if (strlen(infile) >= PATH_MAX) { |
errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); | errno = ENAMETOOLONG; |
| fatal("%s", infile); |
| } |
|
|
/* |
/* |
* If we were given a fully qualified or relative path |
* If we were given a fully qualified or relative path |
Line 104 find_path(char *infile, char **outfile, struct stat *s
|
Line 105 find_path(char *infile, char **outfile, struct stat *s
|
* Resolve the path and exit the loop if found. |
* Resolve the path and exit the loop if found. |
*/ |
*/ |
len = snprintf(command, sizeof(command), "%s/%s", path, infile); |
len = snprintf(command, sizeof(command), "%s/%s", path, infile); |
if (len <= 0 || len >= sizeof(command)) | if (len <= 0 || len >= sizeof(command)) { |
errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); | errno = ENAMETOOLONG; |
| fatal("%s", infile); |
| } |
if ((found = sudo_goodpath(command, sbp))) |
if ((found = sudo_goodpath(command, sbp))) |
break; |
break; |
|
|
Line 119 find_path(char *infile, char **outfile, struct stat *s
|
Line 122 find_path(char *infile, char **outfile, struct stat *s
|
*/ |
*/ |
if (!found && checkdot) { |
if (!found && checkdot) { |
len = snprintf(command, sizeof(command), "./%s", infile); |
len = snprintf(command, sizeof(command), "./%s", infile); |
if (len <= 0 || len >= sizeof(command)) | if (len <= 0 || len >= sizeof(command)) { |
errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); | errno = ENAMETOOLONG; |
| fatal("%s", infile); |
| } |
found = sudo_goodpath(command, sbp); |
found = sudo_goodpath(command, sbp); |
if (found && ignore_dot) |
if (found && ignore_dot) |
debug_return_int(NOT_FOUND_DOT); |
debug_return_int(NOT_FOUND_DOT); |