Skip to content

Commit

Permalink
[mms_codec] Fixed parsing of the absolute date header. Fixes MER#1674
Browse files Browse the repository at this point in the history
  • Loading branch information
monich committed Oct 17, 2016
1 parent 2d9cc75 commit da0064d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mms-lib/src/mms_codec.c
Expand Up @@ -642,13 +642,19 @@ static gboolean extract_absolute_relative_date(struct wsp_header_iter *iter,
unsigned int i;
unsigned int seconds;

/*
* Absolute-token Date-value | Relative-token Delta-seconds-value
* Absolute-token = <Octet 128>
* Relative-token = <Octet 129>
*/
if (wsp_header_iter_get_val_type(iter) != WSP_VALUE_TYPE_LONG)
return FALSE;

p = wsp_header_iter_get_val(iter);
l = wsp_header_iter_get_val_len(iter);

if (l < 2 || l > 5)
/* Token (1 byte) + value length (1 byte) + up to 4 bytes */
if (l < 2 || l > 6)
return FALSE;

if (p[0] != 128 && p[0] != 129)
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions mms-lib/test/test_mms_codec/test_mms_codec.c
Expand Up @@ -59,6 +59,7 @@ int main(int argc, char* argv[])
"m-notification_1.ind",
"m-notification_2.ind",
"m-notification_3.ind",
"m-notification_4.ind",
"m-delivery.ind",
"m-read-orig.ind",
"m-retrieve_1.conf",
Expand Down

0 comments on commit da0064d

Please sign in to comment.