Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 1997 08:06:47 -0700 (PDT)
From:      J.Hogeveen@twiddle.com
To:        freebsd-gnats-submit@freebsd.org
Subject:   bin/3240: ls(1) gets segmentation fault. /usr/src/bin/ls/ls.c:428.
Message-ID:  <199704091506.IAA24369@freefall.freebsd.org>
Resent-Message-ID: <199704091510.IAA24533@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3240
>Category:       bin
>Synopsis:       ls(1) gets segmentation fault. /usr/src/bin/ls/ls.c:428.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr  9 08:10:01 PDT 1997
>Last-Modified:
>Originator:     Jeroen Hogeveen
>Organization:
Twiddle
>Release:        2.2-STABLE
>Environment:
FreeBSD dot.twiddle.com 2.2-STABLE FreeBSD 2.2-STABLE #0: Thu Apr  3 10:26:03 GMT 1997     vego@dot.twiddle.com:/usr/src/sys/compile/DOT  i386
>Description:
Here is a quick output from the gdb debugger:

dot# gdb ./ls
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd), Copyright 1996 Free Software Foundation, Inc...
(gdb) run -l /usr/ports
Starting program: /usr/obj/usr/src/bin/ls/./ls -l /usr/ports
Program received signal SIGSEGV, Segmentation fault.
0x1fba in display (p=0x33100, list=0x33b00) at /usr/src/bin/ls/ls.c:428
428                                     if ((ulen = strlen(user)) > maxuser)
(gdb) where
#0  0x1fba in display (p=0x33100, list=0x33b00) at /usr/src/bin/ls/ls.c:428
#1  0x1d32 in traverse (argc=1, argv=0xefbfd914, options=16)
    at /usr/src/bin/ls/ls.c:338
#2  0x1ba1 in main (argc=3, argv=0xefbfd90c) at /usr/src/bin/ls/ls.c:275
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y

I think it gets the segmentation fault from doing a strlen(NULL).
Haven't checked if user is NULL yet, though, because of slow connection right now.
If I can find some more time soon, I'll look into it. (if it isn't fixed already, by then ;-)
>How-To-Repeat:
No idea.
The problem appears only when doing ls with -l on /usr/ports.
On my home system (also 2.2-STABLE) this problem does not occur, so it's
unique to the /usr/ports directory at dot.twiddle.com.
>Fix:
First guess: check if (user)
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704091506.IAA24369>