diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-01-25 18:20:51 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-01-25 18:20:55 +0100 |
commit | 282d4e3dda5c3a1eabb76da601c5a680a1ccbd15 (patch) | |
tree | 855b53c66cdf6fccff722fce41626c77c28671a9 | |
parent | 42d3250d1790dffc30fc0ce02bd520c2e8445637 (diff) |
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
-rw-r--r-- | gtp/gtp.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2696,7 +2696,7 @@ int gtp_gpdu_ind(struct gsn_t *gsn, int version, 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 @@ int gtp_gpdu_ind(struct gsn_t *gsn, int version, 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 */ |