Change in libosmocore[master]: gprs_ns2_frgre: check iph/ip6h before passing them to rx functions

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

laforge gerrit-no-reply at lists.osmocom.org
Wed Feb 3 13:55:06 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/22648 )

Change subject: gprs_ns2_frgre: check iph/ip6h before passing them to rx functions
......................................................................

gprs_ns2_frgre: check iph/ip6h before passing them to rx functions

With IPv4 and IPv6 support it's not guaranteed that iph/ip6h is valid.

Related CID#214288

Change-Id: If9015906917e3ad11d14b84c29d64f28a3158144
---
M src/gb/gprs_ns2_frgre.c
1 file changed, 8 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_frgre.c b/src/gb/gprs_ns2_frgre.c
index f163704..177aeb2 100644
--- a/src/gb/gprs_ns2_frgre.c
+++ b/src/gb/gprs_ns2_frgre.c
@@ -351,11 +351,17 @@
 	switch (osmo_ntohs(greh->ptype)) {
 	case GRE_PTYPE_IPv4:
 		/* IPv4 messages might be GRE keepalives */
-		*error = handle_rx_gre_ipv4(bfd, msg, iph, greh);
+		if (iph)
+			*error = handle_rx_gre_ipv4(bfd, msg, iph, greh);
+		else
+			*error = -EIO;
 		goto out_err;
 		break;
 	case GRE_PTYPE_IPv6:
-		*error = handle_rx_gre_ipv6(bfd, msg, ip6h, greh);
+		if (ip6h)
+			*error = handle_rx_gre_ipv6(bfd, msg, ip6h, greh);
+		else
+			*error = -EIO;
 		goto out_err;
 		break;
 	case GRE_PTYPE_FR:

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/22648
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If9015906917e3ad11d14b84c29d64f28a3158144
Gerrit-Change-Number: 22648
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210203/17ba367d/attachment.htm>


More information about the gerrit-log mailing list