From 163c37a5a3667fd0f541598ce79e3b8f7990b9c6 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Wed, 1 Feb 2017 12:17:39 +0100
Subject: [PATCH] bugfix: return error in 'emm_msg_encode' in case of failure

---
 openair3/NAS/COMMON/EMM/MSG/emm_msg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
index b067b9c0d1..c357e8784f 100644
--- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
+++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c
@@ -464,6 +464,9 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
 #endif
   }
 
+  if (encode_result < 0)
+    LOG_FUNC_RETURN (encode_result);
+
   LOG_FUNC_RETURN (header_result + encode_result);
 }
 
-- 
GitLab