1
0
Fork 0

misc fixes for mms decoding PANICs

This commit is contained in:
bagyenda 2008-07-04 14:51:26 +00:00
parent 6445ca1403
commit 5b5fa1fd7b
2 changed files with 27 additions and 10 deletions

View File

@ -1,4 +1,6 @@
2008-07-01 P. A. Bagyenda 2008-07-04 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fixes for PANICs in mms_msg.c
2008-07-01 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix to MM4 interface -- address formatting fix * Minor fix to MM4 interface -- address formatting fix
2008-06-27 P. A. Bagyenda <bagyenda@dsmagic.com> 2008-06-27 P. A. Bagyenda <bagyenda@dsmagic.com>
* Minor fix to MM4 .RES handling: use proxy sendmail command if present * Minor fix to MM4 .RES handling: use proxy sendmail command if present

View File

@ -320,8 +320,10 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
decoded = wsp_unpack_integer_value(context); decoded = wsp_unpack_integer_value(context);
ret2= wsp_field_value(context, &val); ret2= wsp_field_value(context, &val);
octstr_append(decoded, decode_encoded_string_value(ret2, context, hname)); if (decoded)
octstr_append(decoded, decode_encoded_string_value(ret2, context, hname));
else
warning(0, "Error decoding Header-Response-Text header value");
if (ret2 == WSP_FIELD_VALUE_DATA) { /* we need to skip to end of inner value-data. */ if (ret2 == WSP_FIELD_VALUE_DATA) { /* we need to skip to end of inner value-data. */
parse_skip_to_limit(context); parse_skip_to_limit(context);
parse_pop_limit(context); parse_pop_limit(context);
@ -347,7 +349,12 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
Octstr *t; Octstr *t;
decoded = wsp_unpack_integer_value(context); decoded = wsp_unpack_integer_value(context);
t = parse_get_nul_string(context); t = parse_get_nul_string(context);
octstr_append(decoded, t); if (decoded)
octstr_append(decoded, t);
else
warning(0, "error decoding value for header %s\n",
hname);
octstr_destroy(t); octstr_destroy(t);
} else if (ret != WSP_FIELD_VALUE_NUL_STRING) } else if (ret != WSP_FIELD_VALUE_NUL_STRING)
warning(0, "Unexpected field value type %d for header %s\n", warning(0, "Unexpected field value type %d for header %s\n",
@ -392,8 +399,11 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
wsp_field_value(context, &val); wsp_field_value(context, &val);
x = mms_response_status_to_cstr(val|0x80); x = mms_response_status_to_cstr(val|0x80);
octstr_append_cstr(decoded, (char *)x); if (decoded)
octstr_append_cstr(decoded, (char *)x);
else
warning(0, "error decoding field_value_data value for header %s\n",
hname);
} else } else
ch = mms_response_status_to_cstr(val|0x80); ch = mms_response_status_to_cstr(val|0x80);
break; break;
@ -432,7 +442,6 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
ch = wsp_content_type_to_cstr(val); ch = wsp_content_type_to_cstr(val);
else if (ret == WSP_FIELD_VALUE_DATA) else if (ret == WSP_FIELD_VALUE_DATA)
decoded = wsp_unpack_accept_general_form(context); decoded = wsp_unpack_accept_general_form(context);
break; break;
case MMS_HEADER_DELIVERY_TIME: case MMS_HEADER_DELIVERY_TIME:
@ -491,8 +500,11 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
t = decode_encoded_string_value(-1, context, hname); t = decode_encoded_string_value(-1, context, hname);
else else
t = wsp_unpack_date_value(context); t = wsp_unpack_date_value(context);
if (decoded)
octstr_append(decoded, t); octstr_append(decoded, t);
else
warning(0, "error decoding value for header %s!",
hname);
octstr_destroy(t); octstr_destroy(t);
} }
break; break;
@ -548,7 +560,10 @@ static int mms_unpack_well_known_field(List *unpacked, int field_type,
else { else {
int n = parse_get_char(context); int n = parse_get_char(context);
decoded = wsp_unpack_integer_value(context); decoded = wsp_unpack_integer_value(context);
octstr_format_append(decoded, " %s", (n == 0x80) ? "msgs" : "bytes"); if (decoded)
octstr_format_append(decoded, " %s", (n == 0x80) ? "msgs" : "bytes");
else
warning(0, "error decoding value for header %s!\n", hname);
} }
break; break;
case MMS_HEADER_MM_FLAGS: case MMS_HEADER_MM_FLAGS: