NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/40753



On Jun 24,  3:00pm, spetrov%mallsi.com@localhost ("Svetoslav Petrov") wrote:
-- Subject: Re: lib/40753

|  bash-3.2# gdb ./test
|  
|  GNU gdb 5.3nb1
|  
|  Copyright 2002 Free Software Foundation, Inc.
|  
|  GDB is free software, covered by the GNU General Public License, and you are
|  
|  welcome to change it and/or 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.
|  
|  This GDB was configured as "x86_64--netbsd"...
|  
|  (gdb) run
|  
|  Starting program: /root/programs/test/test
|  
|   
|  
|  Program received signal SIGSEGV, Segmentation fault.
|  
|  0x00007f7ffdbcea70 in strlen () from /usr/lib/libc.so.12
|  
|  (gdb) bt
|  
|  #0  0x00007f7ffdbcea70 in strlen () from /usr/lib/libc.so.12
|  
|  (gdb)

The bug is in your code. You need to include <string.h> before you
can use strerror(). Otherwise the compiler thinks it defaults to
int and does not return the full pointer leading to a crash.
gcc -Wall is your friend.

christos


Home | Main Index | Thread Index | Old Index