2003-06-03 Roland McGrath <roland@redhat.com>

* strace.c (main): In PATH search, accept only a regular file with
	execute bits set.  Fixes Debian bug #137103.
This commit is contained in:
Roland McGrath 2003-06-03 07:18:19 +00:00
parent 454a024a9b
commit ed64516fa4

View File

@ -439,7 +439,12 @@ char *argv[];
if (len && pathname[len - 1] != '/')
pathname[len++] = '/';
strcpy(pathname + len, filename);
if (stat(pathname, &statbuf) == 0)
if (stat(pathname, &statbuf) == 0 &&
/* Accept only regular files
with some execute bits set.
XXX not perfect, might still fail */
S_ISREG(statbuf.st_mode) &&
(statbuf.st_mode & 0111))
break;
}
}