fixed: mms_validate_address looks for null
This commit is contained in:
parent
59e844d16c
commit
be411e731b
|
@ -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. */
|
||||
|
|
Loading…
Reference in New Issue