From da0064d7799902f2f472cd7cbda909939bd3e24a Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 16 Oct 2016 01:00:48 +0300 Subject: [PATCH] [mms_codec] Fixed parsing of the absolute date header. Fixes MER#1674 --- mms-lib/src/mms_codec.c | 8 +++++++- .../test/test_mms_codec/data/m-notification_4.ind | Bin 0 -> 145 bytes mms-lib/test/test_mms_codec/test_mms_codec.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 mms-lib/test/test_mms_codec/data/m-notification_4.ind diff --git a/mms-lib/src/mms_codec.c b/mms-lib/src/mms_codec.c index ab364e8..9cf778b 100644 --- a/mms-lib/src/mms_codec.c +++ b/mms-lib/src/mms_codec.c @@ -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 = + * Relative-token = + */ 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) diff --git a/mms-lib/test/test_mms_codec/data/m-notification_4.ind b/mms-lib/test/test_mms_codec/data/m-notification_4.ind new file mode 100644 index 0000000000000000000000000000000000000000..d408d11c1aefbde81044ea2e83f683ae65c43625 GIT binary patch literal 145 zcmeBanqgpI5D&yCAl`tXcS0vm1459YtD%pX=X^^CTLVjkmPuA~MoCG5mA-ySUX^Z9 zYDrOMYFVmYacQ2BUQT9uMoDpLQJP*}YKfJFfxdliae8KoEzm41_NbK>rxtmFWkHrP F002OwDqH{n literal 0 HcmV?d00001 diff --git a/mms-lib/test/test_mms_codec/test_mms_codec.c b/mms-lib/test/test_mms_codec/test_mms_codec.c index f072a30..6112f2b 100644 --- a/mms-lib/test/test_mms_codec/test_mms_codec.c +++ b/mms-lib/test/test_mms_codec/test_mms_codec.c @@ -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",