[Debian-mobcom-maintainers] Bug#976866: osmo-sgsn: possible null pointer dereferences
Steve Langasek
steve.langasek at canonical.com
Tue Dec 8 19:58:28 GMT 2020
Package: osmo-sgsn
Version: 1.3.0-3
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu hirsute ubuntu-patch
Dear maintainers,
The osmo-sgsn package is failing to bulid from source on s390x in Ubuntu,
because the compiler detects that certain pointer dereferences may be acting
on a null pointer:
gprs_subscriber.c: In function ‘gprs_subscr_get_or_create_by_mmctx’:
gprs_subscriber.c:849:17: error: potential null pointer dereference [-Werror=null-dereference]
849 | subscr->flags |= GPRS_SUBSCRIBER_FIRST_CONTACT;
| ^~
gprs_subscriber.c:850:17: error: potential null pointer dereference [-Werror=null-dereference]
850 | subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE;
(https://launchpad.net/ubuntu/+source/osmo-sgsn/1.3.0-3/+build/20177923)
I haven't looked into why this build failure doesn't happen on other archs,
or why it wasn't seen on s390x in Debian; but I've confirmed that the
compiler's errors are correct. The attached patch avoids the possible
null-pointer dereferences and lets the package build.
Thanks for considering,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer https://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
diff -Nru osmo-sgsn-1.3.0/debian/patches/no-null-pointer-derefence.patch osmo-sgsn-1.3.0/debian/patches/no-null-pointer-derefence.patch
--- osmo-sgsn-1.3.0/debian/patches/no-null-pointer-derefence.patch 1969-12-31 16:00:00.000000000 -0800
+++ osmo-sgsn-1.3.0/debian/patches/no-null-pointer-derefence.patch 2020-12-08 11:48:04.000000000 -0800
@@ -0,0 +1,36 @@
+Description: avoid possible null dereferences
+ Detected by the compiler on Ubuntu s390x
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Update: 2020-12-08
+
+Index: osmo-sgsn-1.3.0/src/gprs/gprs_subscriber.c
+===================================================================
+--- osmo-sgsn-1.3.0.orig/src/gprs/gprs_subscriber.c
++++ osmo-sgsn-1.3.0/src/gprs/gprs_subscriber.c
+@@ -846,6 +846,8 @@
+
+ if (!subscr) {
+ subscr = gprs_subscr_get_or_create(mmctx->imsi);
++ if (!subscr)
++ return NULL;
+ subscr->flags |= GPRS_SUBSCRIBER_FIRST_CONTACT;
+ subscr->flags &= ~GPRS_SUBSCRIBER_ENABLE_PURGE;
+ }
+@@ -869,6 +871,8 @@
+ LOGMMCTXP(LOGL_DEBUG, mmctx, "Requesting subscriber data update\n");
+
+ subscr = gprs_subscr_get_or_create_by_mmctx(mmctx);
++ if (!subscr)
++ return -EINVAL;
+
+ subscr->flags |= GPRS_SUBSCRIBER_UPDATE_LOCATION_PENDING;
+
+@@ -894,6 +898,8 @@
+ LOGMMCTXP(LOGL_DEBUG, mmctx, "Requesting subscriber authentication info\n");
+
+ subscr = gprs_subscr_get_or_create_by_mmctx(mmctx);
++ if (!subscr)
++ return -EINVAL;
+
+ subscr->flags |= GPRS_SUBSCRIBER_UPDATE_AUTH_INFO_PENDING;
+
diff -Nru osmo-sgsn-1.3.0/debian/patches/series osmo-sgsn-1.3.0/debian/patches/series
--- osmo-sgsn-1.3.0/debian/patches/series 2020-08-09 10:28:26.000000000 -0700
+++ osmo-sgsn-1.3.0/debian/patches/series 2020-12-08 11:31:57.000000000 -0800
@@ -1,3 +1,4 @@
0001-Spelling-fixes.patch
0002-Compare-with-ENOTSUP-to-fix-build-on-mipsel-mips64el.patch
gcc10.patch
+no-null-pointer-derefence.patch
More information about the Debian-mobcom-maintainers
mailing list