bin/64150: [PATCH] ls(1) coredumps when started via execve(2) with
no argv.
Morten Rodal
morten at rodal.no
Fri Mar 12 01:30:23 PST 2004
>Number: 64150
>Category: bin
>Synopsis: [PATCH] ls(1) coredumps when started via execve(2) with no argv.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Mar 12 01:30:23 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Morten Rodal
>Release: FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD stud326.idi.ntnu.no 5.2-CURRENT FreeBSD 5.2-CURRENT #2: Mon Mar 1 02:38:57 CET 2004 root at stud326.idi.ntnu.no:/usr/obj/usr/src/sys/stud326 i386
>Description:
ls(1) calls the fts(3) functions for traversing a file hierarchy. If ls(1) is
executed via execve(2) system call with a NULL argv and envp it will make
the fts(3) functions core dump with a SIGBUS.
If execve(2) is executed with a NULL (I am not sure this is legal?) argv, the
executed program will have an argc value of -1.
>How-To-Repeat:
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
execve("/bin/ls", NULL, NULL);
return (1);
}
>Fix:
--- ls.c.orig Fri Mar 12 10:19:08 2004
+++ ls.c Fri Mar 12 10:21:08 2004
@@ -430,7 +430,7 @@
else
printfcn = printcol;
- if (argc)
+ if (argc >= 1)
traverse(argc, argv, fts_options);
else
traverse(1, dotav, fts_options);
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list