diff options
author | Harald Welte <laforge@osmocom.org> | 2019-12-01 09:25:27 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2019-12-01 09:26:49 +0100 |
commit | fdf33589594968e2e8fc2f4799bea248a014d691 (patch) | |
tree | d02a3646c02a286328a37236cbb96991aeeef4c3 /sgsnemu/sgsnemu.c | |
parent | 1bf41e4f36b28325e028a705e88a4544706ab786 (diff) |
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
Diffstat (limited to 'sgsnemu/sgsnemu.c')
-rw-r--r-- | sgsnemu/sgsnemu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c index 863ea51..7904c49 100644 --- a/sgsnemu/sgsnemu.c +++ b/sgsnemu/sgsnemu.c @@ -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; } |