[PATCH] libosmo-netif[master]: Fix potential NULL dereference

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

Max gerrit-no-reply at lists.osmocom.org
Fri Jan 20 18:39:13 UTC 2017


Review at  https://gerrit.osmocom.org/1639

Fix potential NULL dereference

Fix potential NULL pointer dereference in osmux_xfrm_input_deliver() and
tighten compiler options to prevent this from reappearing.

Change-Id: I5baf369dbf3948565614476980a32be59abaf42a
---
M configure.ac
M debian/control
M src/osmux.c
3 files changed, 15 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/39/1639/1

diff --git a/configure.ac b/configure.ac
index 3994aff..7ee7d2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,18 @@
 dnl FIXME: We depend on libosmoabis by now until we can move LAPD code here
 PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.0.7)
 
+m4_ifdef([AX_CHECK_COMPILE_FLAG], [
+             AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
+             AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS -Werror=maybe-uninitialized"])
+             AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS -Werror=memset-transposed-args"])
+             AX_CHECK_COMPILE_FLAG([-Werror=null-dereference], [CFLAGS="$CFLAGS -Werror=null-dereference"])
+             AX_CHECK_COMPILE_FLAG([-Werror=sizeof-array-argument], [CFLAGS="$CFLAGS -Werror=sizeof-array-argument"])
+             AX_CHECK_COMPILE_FLAG([-Werror=sizeof-pointer-memaccess], [CFLAGS="$CFLAGS -Werror=sizeof-pointer-memaccess"])
+         ], [
+             AC_MSG_ERROR([You have to install autoconf-archive package.])
+         ]
+)
+
 old_LIBS=$LIBS
 AC_SEARCH_LIBS([sctp_send], [sctp], [
 	AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
diff --git a/debian/control b/debian/control
index f4c94bb..88edb2c 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@
 Build-Depends: debhelper (>= 9),
                autotools-dev,
                autoconf,
+               autoconf-archive,
                automake,
                libtool,
                dh-autoreconf,
diff --git a/src/osmux.c b/src/osmux.c
index 0bee9cc..913d68f 100644
--- a/src/osmux.c
+++ b/src/osmux.c
@@ -394,7 +394,8 @@
 	LOGP(DLMIB, LOGL_DEBUG, "invoking delivery function\n");
 #endif
 	batch_msg = osmux_build_batch(batch, h->batch_size, h->batch_factor);
-
+	if (!batch_msg)
+		return;
 	h->stats.output_osmux_msgs++;
 	h->stats.output_osmux_bytes += batch_msg->len;
 

-- 
To view, visit https://gerrit.osmocom.org/1639
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5baf369dbf3948565614476980a32be59abaf42a
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list