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

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 25 19:44:55 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: compression: Fix nullpointer deref
......................................................................


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(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I87371ade0ccd6a93b446f2013c1747f486739518
Gerrit-PatchSet: 5
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list