Change in osmo-ggsn[master]: sgsnemu: Fix null-pointer format string argument

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sun Dec 1 14:30:26 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/16353 )

Change subject: sgsnemu: Fix null-pointer format string argument
......................................................................

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
---
M sgsnemu/sgsnemu.c
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



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;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/16353
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I417f447f821d396aa92049e0a791121240f1cf44
Gerrit-Change-Number: 16353
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191201/8d2b842b/attachment.htm>


More information about the gerrit-log mailing list