aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-08-03 03:45:06 +0700
committerHarald Welte <laforge@gnumonks.org>2018-08-05 07:14:19 +0000
commit3fc4616224db31d4c4b14d919dd5c719d4ab19f1 (patch)
treead9807c8f44be7f6051be2f41760b06cf1d8dc96
parent893e49e99359fb80b25aa3ba5e1c8f03b07e66a3 (diff)
gsm/gsm0480.c: prevent NULL-pointer dereference
-rw-r--r--src/gsm/gsm0480.c12
1 files changed, 10 insertions, 2 deletions
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_create_ussd_resp(uint8_t invoke_id, uint8_t trans_id, const
*/
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_return_error(uint8_t invoke_id, uint8_t error_code)
*/
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);