Sorry, I've sent the wrong trace from a locally-modified version,
with debug code infusions and s/vsnprintf/snprintf/.

The trace for proper[1] version is attached below.

(gdb) run
Starting program: /usr/sbin/danted 
Nov  7 20:13:52 (1226078032) danted[16526]: socks_seteuid(): old: 0, new: 13
Nov  7 20:13:52 (1226078032) danted[16526]: socks_reseteuid(): current: 13, 
new: 0
Nov  7 20:13:52 (1226078032) danted[16526]: socks_seteuid(): old: 0, new: 65534
Nov  7 20:13:52 (1226078032) danted[16526]: socks_reseteuid(): current: 65534, 
new: 0
Nov  7 20:13:52 (1226078032) danted[16526]: socks_seteuid(): old: 0, new: 65534
Nov  7 20:13:52 (1226078032) danted[16526]: socks_reseteuid(): current: 65534, 
new: 0

Program received signal SIGSEGV, Segmentation fault.
0x00007f72968ad030 in strlen () from /usr/lib/debug/libc.so.6
(gdb) bt
#0  0x00007f72968ad030 in strlen () from /usr/lib/debug/libc.so.6
#1  0x00007f7296879cb1 in _IO_vfprintf_internal (s=0x7fff9f8050c0, 
format=<value optimized out>, ap=0x7fff9f805ae0) at vfprintf.c:1560
#2  0x00007f729689f20a in _IO_vsnprintf (string=0x7fff9f8052cc "(null)/server 
vI", maxlen=<value optimized out>, format=0x433242 "%s/server v%s running", 
args=0x7fff9f805ae0)
    at vsnprintf.c:120
#3  0x00000000004156ac in logformat (priority=6, buf=0x7fff9f8052a0 "Nov  7 
20:13:52 (1226078032) danted[16526]: (null)/server vI", buflen=2048, 
message=0x433242 "%s/server v%s running", 
    ap=0x7fff9f805ae0) at ../lib/log.c:205
#4  0x00000000004154b6 in vslog (priority=6, message=0x433242 "%s/server v%s 
running", ap=0x7fff9f805ae0) at ../lib/log.c:134
#5  0x00000000004153f4 in slog (priority=6, message=0x433242 "%s/server v%s 
running") at ../lib/log.c:107
#6  0x000000000040804e in main (argc=1, argv=0x7fff9f8089f8, 
envp=0x7fff9f808a08) at sockd.c:347


regards, Samium Gromoff


1. An interesting observation still holds: if you change the call
to vsnprintf to snprintf while dropping the varargs, and step through
the call chain, the first parameter to snprintf will be intact,
whereas the post-mortem stack unwind will show its sickly nature...

(gdb) break logformat
Breakpoint 1 at 0x4155c2: file ../lib/log.c, line 185.
(gdb) run
Starting program: /usr/sbin/danted 

Breakpoint 1, logformat (priority=7, buf=0x7fff49657e90 "", buflen=2048, 
message=0x43565d "%s: old: %lu, new: %lu", ap=0x7fff496586d0) at 
../lib/log.c:185
185             if (sockscf.state.pid == 0)
(gdb) next
186                     pid = getpid();
(gdb) 
190             switch (priority) {
(gdb) 
192                             if (sockscf.state.init && !sockscf.option.debug)
(gdb) 
198             time(&timenow);
(gdb) 
199             bufused = strftime(buf, buflen, "%h %e %T ", 
localtime(&timenow));
(gdb) 
201             bufused += snprintfn(&buf[bufused], buflen - bufused, "(%ld) 
%s[%lu]: ",
(gdb) 
205             snprintf(&buf[bufused], buflen - bufused, message);
(gdb) step
__snprintf (s=0x7fff49657ebc "", maxlen=2004, format=0x43565d "%s: old: %lu, 
new: %lu") at snprintf.c:30
30      snprintf.c: No such file or directory.
        in snprintf.c
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007fe140700030 in strlen () from /usr/lib/debug/libc.so.6
(gdb) bt
#0  0x00007fe140700030 in strlen () from /usr/lib/debug/libc.so.6
#1  0x00007fe1406cccb1 in _IO_vfprintf_internal (s=0x7fff49657bd0, 
format=<value optimized out>, ap=0x7fff49657d30) at vfprintf.c:1560
#2  0x00007fe1406f220a in _IO_vsnprintf (string=0x7fff49657ebc "", 
maxlen=<value optimized out>, format=0x43565d "%s: old: %lu, new: %lu", 
args=0x7fff49657d30) at vsnprintf.c:120
#3  0x00007fe1406d2d43 in __snprintf (s=0x1c <Address 0x1c out of bounds>, 
maxlen=4413021, format=0x7fff49657d68 "\034") at snprintf.c:35
#4  0x00000000004156ad in logformat (priority=7, buf=0x7fff49657e90 "Nov  7 
20:21:21 (1226078481) danted[17696]: ", buflen=2048, message=0x43565d "%s: old: 
%lu, new: %lu", ap=0x7fff496586d0)
    at ../lib/log.c:205
#5  0x00000000004154b6 in vslog (priority=7, message=0x43565d "%s: old: %lu, 
new: %lu", ap=0x7fff496586d0) at ../lib/log.c:134
#6  0x00000000004153f4 in slog (priority=7, message=0x43565d "%s: old: %lu, 
new: %lu") at ../lib/log.c:107
#7  0x000000000041736b in socks_seteuid (old=0x7fff496587fc, new=13) at 
sockd_util.c:257
#8  0x0000000000403a6b in fixconfig () at config_parse.y:1347
#9  0x0000000000403496 in readconfig (filename=0x4332ec "/etc/danted.conf") at 
config_parse.y:1209
#10 0x0000000000415d4e in genericinit () at ../lib/config.c:75
#11 0x0000000000408b8b in serverinit (argc=0, argv=0x7fff4965b850, 
envp=0x7fff4965b858) at sockd.c:837
#12 0x0000000000407a37 in main (argc=1, argv=0x7fff4965b848, 
envp=0x7fff4965b858) at sockd.c:177



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to