[PATCH] 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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jan 25 20:13:01 UTC 2018


Review at  https://gerrit.osmocom.org/6072

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/72/6072/1

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: newchange
Gerrit-Change-Id: Ib3e23b61a3521bd3c9002d3165ca8eff4361a35e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list