[MERGED] osmo-ggsn[master]: gtp.c: gtp_gpdu_ind: Early return to avoid use of uninitiali...

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Jan 26 00:32:55 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: gtp.c: gtp_gpdu_ind: Early return to avoid use of uninitialized var
......................................................................


gtp.c: gtp_gpdu_ind: Early return to avoid use of uninitialized var

If the version received is not known, pdp is then uninitalized so we
should not be using it. Let's return an error to inform the caller.

Change-Id: Ib3e23b61a3521bd3c9002d3165ca8eff4361a35e
---
M gtp/gtp.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/gtp/gtp.c b/gtp/gtp.c
index a2526a3..9dabcd2 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -2696,7 +2696,7 @@
 		 struct sockaddr_in *peer, int fd, void *pack, unsigned len)
 {
 
-	int hlen = GTP1_HEADER_SIZE_SHORT;
+	int hlen;
 
 	/* Need to include code to verify packet src and dest addresses */
 	struct pdp_t *pdp;
@@ -2732,6 +2732,7 @@
 	default:
 		GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
 			    "Unknown version: %d\n", version);
+		return EOF;
 	}
 
 	/* If the GPDU was not from the peer GSN tell him to delete context */

-- 
To view, visit https://gerrit.osmocom.org/6072
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3e23b61a3521bd3c9002d3165ca8eff4361a35e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list