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
This commit is contained in:
Pau Espin 2018-01-25 18:20:51 +01:00
parent 42d3250d17
commit 282d4e3dda
1 changed files with 2 additions and 1 deletions

View File

@ -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 */