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
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 @@
}
} else {
SYS_ERR(DSGSN, LOGL_ERROR, 0,
- "Listening address must be specified: %s!",
- args_info.listen_arg);
+ "Listening address must be specified!");
return -1;
}