All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stkutil: fix crash issue cause by null length of text string
@ 2010-12-07 10:58 Lucas, GuillaumeX
  2010-12-07 20:25 ` Andrzej Zaborowski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lucas, GuillaumeX @ 2010-12-07 10:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1672 bytes --]

From: Guillaume Lucas <guillaumex.lucas@intel.com>

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.


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-10 16:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 10:58 [PATCH] stkutil: fix crash issue cause by null length of text string Lucas, GuillaumeX
2010-12-07 20:25 ` Andrzej Zaborowski
2010-12-07 21:55 ` Jeevaka.Badrappan
2010-12-07 22:33   ` Andrzej Zaborowski
2010-12-08  8:37     ` Lucas, GuillaumeX
2010-12-10 16:48 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.