mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-ggsn.git
synced 2025-11-02 21:23:23 +00:00
sgsnemu: Fix null-pointer format string argument
Modern gcc-9.2.1 actually fails like this with --enable-werror active:
In file included from sgsnemu.c:52:
In function ‘process_options’,
inlined from ‘main’ at sgsnemu.c:1557:6:
../lib/syserr.h:31:3: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
31 | logp2(sub, pri, __FILE__, __LINE__, 0, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 | fmt "\n", ##args); \
| ~~~~~~~~~~~~~~~~~
sgsnemu.c:435:3: note: in expansion of macro ‘SYS_ERR’
435 | SYS_ERR(DSGSN, LOGL_ERROR, 0,
| ^~~~~~~
sgsnemu.c: In function ‘main’:
sgsnemu.c:436:42: note: format string is defined here
436 | "Listening address must be specified: %s!",
| ^~
It is correct: We are dereferencing args_info.listen_addr in a
branch which explicitly checks if that is NULL beforehand :/
Change-Id: I417f447f821d396aa92049e0a791121240f1cf44
This commit is contained in:
@@ -433,8 +433,7 @@ static int process_options(int argc, char **argv)
|
||||
}
|
||||
} else {
|
||||
SYS_ERR(DSGSN, LOGL_ERROR, 0,
|
||||
"Listening address must be specified: %s!",
|
||||
args_info.listen_arg);
|
||||
"Listening address must be specified!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user