mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-16 01:32:54 -04:00
Fix a false positive compiler warning/error on Alpine 3.24
On Alpine Linux 3.24, GCC 15 with fortify-headers produces a compiler
warning when building bin/nsupdate/nsupdate.c:
In function 'fgets',
inlined from 'get_next_command' at ../bin/nsupdate/nsupdate.c:2414:13:
/usr/include/fortify/stdio.h:48:16: error: 'cmdlinebuf' may be used uninitialized [-Werror=maybe-uninitialized]
48 | return __orig_fgets(__s, __n, __f);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/fortify/stdio.h:42:1: note: in a call to '*fgets' declared with attribute 'access (read_write, 1, 2)' here
42 | _FORTIFY_FN(fgets) char *fgets(char * _FORTIFY_POS0 __s, int __n, FILE *__f)
| ^~~~~~~~~~~
../bin/nsupdate/nsupdate.c:2405:14: note: 'cmdlinebuf' declared here
2405 | char cmdlinebuf[MAXCMD];
| ^~~~~~~~~~
This is a false positive, because fgets() only writes into the buffer;
the fortify-headers wrapper annotates the buffer argument with
'access (read_write, ...)', which makes GCC treat passing an
uninitialized buffer as a read of uninitialized memory.
Initialize the 'cmdlinebuf' buffer anyway to avoid the build error.
Assisted-by: Claude:claude-fable-5
(cherry picked from commit 62670aa1b7)
This commit is contained in:
parent
c2b901d5e5
commit
8ce39fdcb1
1 changed files with 1 additions and 1 deletions
|
|
@ -2432,7 +2432,7 @@ do_next_command(char *cmdline) {
|
|||
static uint16_t
|
||||
get_next_command(void) {
|
||||
uint16_t result = STATUS_QUIT;
|
||||
char cmdlinebuf[MAXCMD];
|
||||
char cmdlinebuf[MAXCMD] = { 0 };
|
||||
char *cmdline = NULL, *ptr = NULL;
|
||||
|
||||
if (interactive) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue