From: Andreas Schneider Date: Tue, 9 Jun 2026 09:52:10 +0000 (+0200) Subject: s3:dbwrap: Fix zeroing wrec->added X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b28e73b47452fbd3a5568c947df3fc6ecda06dab;p=thirdparty%2Fsamba.git s3:dbwrap: Fix zeroing wrec->added In file included from source3/include/includes.h:23, from source3/lib/dbwrap/dbwrap_watch.c:20: source3/lib/dbwrap/dbwrap_watch.c: In function ‘dbwrap_watched_watch_remove_instance’: lib/replace/replace.h:850:24: error: ‘memset_explicit’ writing 32 bytes into a region of size 24 overflows the destination [-Werror=stringop-overflow=] GCC 15's -Wstringop-overflow analysis of memset_explicit (via the ZERO_STRUCT macro) tracks the pointer through the (char *) cast and misidentifies the destination as the first member pid (24 bytes) rather than the enclosing struct dbwrap_watcher (32 bytes). This is a GCC false positive. Signed-off-by: Andreas Schneider Reviewed-by: Anoop C S --- diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index e62aba91090..f02401d1855 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -970,7 +970,7 @@ void dbwrap_watched_watch_remove_instance(struct db_record *rec, uint64_t instan DBG_DEBUG("Watcher %s:%"PRIu64" reverted from adding\n", server_id_str_buf(clear_watcher.pid, &buf), clear_watcher.instance); - ZERO_STRUCT(wrec->added); + wrec->added = (struct dbwrap_watcher) { 0 }; } for (i=0; i < wrec->watchers.count; i++) {