From be411e731b6d5d73d53cdc469a62761d27a2d7c7 Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Sun, 16 Mar 2008 16:45:26 +0000 Subject: [PATCH] fixed: mms_validate_address looks for null --- mbuni/mmlib/mms_msg.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mbuni/mmlib/mms_msg.c b/mbuni/mmlib/mms_msg.c index e734c29..301cb64 100644 --- a/mbuni/mmlib/mms_msg.c +++ b/mbuni/mmlib/mms_msg.c @@ -65,9 +65,14 @@ static void encode_uint(Octstr *os, unsigned int l) int mms_validate_address(Octstr *s) { - int i = octstr_search_char(s, '/', 0); - int l = octstr_len(s); + int i; + int l; + if (s == NULL) + return -1; + + i = octstr_search_char(s, '/', 0); + l = octstr_len(s); if (octstr_search_char(s, '@', 0) > 0) return 0; else if (i >= 0) @@ -292,7 +297,7 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (ret == WSP_FIELD_VALUE_DATA) decoded = decode_encoded_string_value(ret, context, hname); - if (mms_validate_address(decoded)) + if (decoded == NULL || mms_validate_address(decoded)) warning(0, "Faulty address [%s] format in field %s!", octstr_get_cstr(decoded), hname); break; @@ -461,7 +466,8 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type, if (n == 0x80) { /* Address present. */ decoded = decode_encoded_string_value(-1,context, hname); - if (mms_validate_address(decoded)) + if (decoded == NULL || + mms_validate_address(decoded)) warning(0, "Faulty address [%s] format in field %s!", octstr_get_cstr(decoded), hname); } else /* Insert address. */