1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/source3/nmbd/wscript_build
Andreas Schneider 8e7a62b6ff waf: Build nmbd with -Wno-error=stringop-overflow
We use strlcpy() which has been added to glibc recently. This means we
also get fortification for strlcpy() now:

source3/nmbd/nmbd_browsesync.c: In function ‘find_domain_master_name_query_success’:
source3/nmbd/nmbd_browsesync.c:337:9: warning: ‘strlcpy’ writing 257 bytes into a
region of size 16 overflows the destination [-Wstringop-overflow=]
  337 |         strlcpy(userdata->data, work->work_group, size - sizeof(*userdata));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We allocate memory for the userdata struct + fstring. However the data
pointer we use only is 16 bytes. Also nowadays you would use offsetof()
for the allocation calculation, but it only works correctly on newer
compilers like gcc > 7. We could make use of it in future after CentOS 7
is gone.

As we don't want to touch nmbd anymore, just silence the warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-28 02:04:36 +00:00

46 lines
1.4 KiB
Python

#!/usr/bin/env python
nmbd_cflags = ''
if bld.CONFIG_SET('HAVE_WNO_ERROR_STRINGOP_OVERFLOW'):
nmbd_cflags = '-Wno-error=stringop-overflow'
bld.SAMBA3_BINARY('nmbd',
source='''
asyncdns.c
nmbd.c
nmbd_become_dmb.c
nmbd_become_lmb.c
nmbd_browserdb.c
nmbd_browsesync.c
nmbd_elections.c
nmbd_incomingdgrams.c
nmbd_incomingrequests.c
nmbd_lmhosts.c
nmbd_logonnames.c
nmbd_mynames.c
nmbd_namelistdb.c
nmbd_namequery.c
nmbd_nameregister.c
nmbd_namerelease.c
nmbd_nodestatus.c
nmbd_packets.c
nmbd_processlogon.c
nmbd_responserecordsdb.c
nmbd_sendannounce.c
nmbd_serverlistdb.c
nmbd_subnetdb.c
nmbd_winsproxy.c
nmbd_winsserver.c
nmbd_workgroupdb.c
nmbd_synclists.c
''',
cflags=nmbd_cflags,
deps='''
talloc
tevent
smbconf
libsmb
CMDLINE_S3
''',
install_path='${SBINDIR}')