Bug 15170 - smbtree seg fault if using -N option.
Summary: smbtree seg fault if using -N option.
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.16.5
Hardware: x86 Linux
: P5 regression (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2022-09-13 16:01 UTC by David
Modified: 2022-09-13 18:17 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description David 2022-09-13 16:01:25 UTC
If i use the -N option with smbtree I get a segmentation fault:
e.g. smbtree -S -N

INTERNAL ERROR: Signal 11: Segmentation fault in pid 17661 (4.16.5)
If you are running a recent Samba version, and if you think this
problem is not yet fixed in the latest versions, please co
nsider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting
PANIC (pid 17661): Signal 11: Segmentation fault in 4.16.5
BACKTRACE: 17 stack frames:
#0 /usr/local/samba/lib/libsamba-util.so.0(log_stack_trace+0x31) [0xb7df6680]
#1 /usr/local/samba/lib/libsamba-util.so.0(smb_panic_log+0x1ad) [0xb7df65f9]
#2 /usr/local/samba/lib/libsamba-util.so.0(smb_panic+0x1d) [0xb7df661c]
#3 /usr/local/samba/lib/libsamba-util.so.0(+0xb13a) [0xb7df613a]
#4 /usr/local/samba/lib/libsamba-util.so.0(+0xb155) [0xb7df6155]
#5 linux-gate.so.1(__kernel_sigreturn+0) [0xb7f85564]
#6 /lib/i386-linux-gnu/libc.so.6(+0x904f6) [0xb7b1d4f6]
#7 /usr/local/samba/lib/private/libreplace-samba4.so(rep_strlcpy+0x1d)
#8 ./smbtree(+0x2aed) [0x48baed]
#9 /usr/local/samba/lib/libsmbclient.so.0(+0x16662) [0xb7e9b662]
#10 /usr/local/samba/lib/libsmbclient.so.0(+0x16886) [0xb7e9b886]
#11 /usr/local/samba/lib/libsmbclient.so.0(+0x16b6e) [0xb7e9bb6e]
#12 /usr/local/samba/lib/libsmbclient.so.0(+0x17965) [0xb7e9c965]
#13 /usr/local/samba/lib/libsmbclient.so.0(+0xcedf) [0xb7e91edf]
#14 ./smbtree(main+0x546) [0x48c04c]
#15 /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0x106) [0xb7aabe46]
#16 ./smbtree(_start+0x31) [0x48b471]
smb_panic(): calling panic action [/usr/share/samba/panic-action 17661]
smb_panic(): action returned status 0
Can not dump core: corepath not set up

I configure it to build using:

#! /bin/bash -x


        --prefix=/usr/local/samba \
        --with-smbpasswd-file=/etc/samba/smbpasswd \
        --with-quota \
        --with-gpgme \
        --without-systemd \
        --disable-cups \
        --without-libarchive \

./configure $conf_args


make installl

Building on Devuan Chimaera (Debian Bullseye)
Comment 1 David 2022-09-13 18:12:44 UTC
This crash is caused by the callback in smbtree.c which tries to strlcpy a nil pointer.  It appears other utilities also copied over the same callback code and they will crash as well.
Comment 2 David 2022-09-13 18:17:52 UTC
I guess I can't edit - on that strlcpy it's actually using the rep_strlcpy version as shown in the backtrace.