aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2021-02-03 11:46:59 +0100
committerAlexander Couzens <lynxis@fe80.eu>2021-02-03 14:37:54 +0100
commit47ed2a6b4a83db4525dd792fbe430a91479efd1c (patch)
tree288c81b11a620eb1012d7cc727598074f78c8d9e /src
parentca3550a261f2e53dab56c7aca75f7b2a070272f4 (diff)
gprs_ns2_frgre: set a correct gre pointer for ipv6
Also fixes a nullpointer deref because iph is NULL on IPv6 Related: CID#216555 Change-Id: I2ff868a7bba6151a2202df774ff022c02b8c34cb
Diffstat (limited to 'src')
-rw-r--r--src/gb/gprs_ns2_frgre.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index 853375d0..f163704e 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -339,7 +339,11 @@ static struct msgb *read_nsfrgre_msg(struct osmo_fd *bfd, int *error,
break;
}
- greh = (struct gre_hdr *) (msg->data + iph->ihl*4);
+ if (iph)
+ greh = (struct gre_hdr *) (msg->data + iph->ihl*4);
+ else
+ greh = (struct gre_hdr *) (msg->data + sizeof(struct ip6_hdr));
+
if (greh->flags) {
LOGBIND(bind, LOGL_NOTICE, "Unknown GRE flags 0x%04x\n", osmo_ntohs(greh->flags));
}