Change in libosmocore[master]: gsm/gsm0480.c: prevent NULL-pointer 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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Aug 5 07:14:19 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10325 )

Change subject: gsm/gsm0480.c: prevent NULL-pointer dereference
......................................................................

gsm/gsm0480.c: prevent NULL-pointer dereference

Change-Id: I444d95941837458b46e581298f76f3a9926c8552
---
M src/gsm/gsm0480.c
1 file changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 2d2df4a..5b51c75 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -880,7 +880,11 @@
  */
 struct msgb *gsm0480_gen_return_error(uint8_t invoke_id, uint8_t error_code)
 {
-	struct msgb *msg = gsm0480_msgb_alloc_name("TS 04.80 ReturnError");
+	struct msgb *msg;
+
+	msg = gsm0480_msgb_alloc_name("TS 04.80 ReturnError");
+	if (!msg)
+		return NULL;
 
 	/* First insert the problem code */
 	msgb_push_TLV1(msg, GSM_0480_ERROR_CODE_TAG, error_code);
@@ -906,7 +910,11 @@
  */
 struct msgb *gsm0480_gen_reject(int invoke_id, uint8_t problem_tag, uint8_t problem_code)
 {
-	struct msgb *msg = gsm0480_msgb_alloc_name("TS 04.80 Reject");
+	struct msgb *msg;
+
+	msg = gsm0480_msgb_alloc_name("TS 04.80 Reject");
+	if (!msg)
+		return NULL;
 
 	/* First insert the problem code */
 	msgb_push_TLV1(msg, problem_tag, problem_code);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I444d95941837458b46e581298f76f3a9926c8552
Gerrit-Change-Number: 10325
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180805/f6bcca87/attachment.htm>


More information about the gerrit-log mailing list