From: Guillaume Lucas <[email protected]>

According to 3GPP TS 31.124 a null length for the text string
should be allowed. An empty string must be returned to the
user in this case.
---
 src/stkutil.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index a211462..cab22f4 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -562,7 +562,7 @@ static gboolean parse_dataobj_text(struct 
comprehension_tlv_iter *iter,
 {
        char **text = user;
        unsigned int len = comprehension_tlv_iter_get_length(iter);
-       const unsigned char *data = comprehension_tlv_iter_get_data(iter);
+       const unsigned char *data;
        char *utf8;
 
        /* DCS followed by some text, cannot be 1 */
@@ -570,10 +570,12 @@ static gboolean parse_dataobj_text(struct 
comprehension_tlv_iter *iter,
                return FALSE;
 
        if (len == 0) {
-               *text = NULL;
+               *text = g_try_malloc0(1);
                return TRUE;
        }
 
+       data = comprehension_tlv_iter_get_data(iter);
+
        utf8 = decode_text(data[0], len - 1, data + 1);
 
        if (utf8 == NULL)
-- 
1.7.0.4

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to