[PATCH] openbsc[master]: compression: Fix nullpointer deref

dexter gerrit-no-reply at lists.osmocom.org
Mon Jan 23 14:41:38 UTC 2017


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

compression: Fix nullpointer deref

When the creation of a new compression entity fails, an error
message is created, this error message contains printf with
a dereferentiation of the compression entity, that is clearly
NULL at that point. This commit corrects that.

Change-Id: I87371ade0ccd6a93b446f2013c1747f486739518
---
M openbsc/src/gprs/gprs_sndcp_comp.c
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/1640/1

diff --git a/openbsc/src/gprs/gprs_sndcp_comp.c b/openbsc/src/gprs/gprs_sndcp_comp.c
index 1591f80..a12c39a 100644
--- a/openbsc/src/gprs/gprs_sndcp_comp.c
+++ b/openbsc/src/gprs/gprs_sndcp_comp.c
@@ -107,13 +107,14 @@
 		}
 	}
 
-	/* Display info message */
+	/* Bail on failure */
 	if (comp_entity == NULL) {
 		LOGP(DSNDCP, LOGL_ERROR,
-		     "Compression entity (%d) creation failed!\n",
-		     comp_entity->entity);
+		     "Compression entity creation failed!\n");
 		return NULL;
 	}
+
+	/* Display info message */
 	if (comp_entity->compclass == SNDCP_XID_PROTOCOL_COMPRESSION) {
 		LOGP(DSNDCP, LOGL_INFO,
 		     "New header compression entity (%d) created.\n",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87371ade0ccd6a93b446f2013c1747f486739518
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>


More information about the gerrit-log mailing list