summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/stkutil.c11
-rw-r--r--src/stkutil.h4
2 files changed, 12 insertions, 3 deletions
diff --git a/src/stkutil.c b/src/stkutil.c
index 9012234f..56c57b1a 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -1628,6 +1628,7 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter,
struct stk_frames_info *fi = user;
const unsigned char *data;
unsigned char len = comprehension_tlv_iter_get_length(iter);
+ unsigned int i;
if (len < 1)
return FALSE;
@@ -1640,12 +1641,18 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter,
if ((len == 1 && data[0] != 0) || (len > 1 && data[0] == 0))
return FALSE;
+ if (len % 2 == 0)
+ return FALSE;
+
if (len == 1)
return TRUE;
fi->id = data[0];
- fi->len = len - 1;
- memcpy(fi->list, data + 1, fi->len);
+ fi->len = (len - 1) / 2;
+ for (i = 0; i < len; i++) {
+ fi->list[i].height = data[i * 2 + 1] & 0x1f;
+ fi->list[i].width = data[i * 2 + 2] & 0x7f;
+ }
return TRUE;
}
diff --git a/src/stkutil.h b/src/stkutil.h
index d5b3c029..d349cca3 100644
--- a/src/stkutil.h
+++ b/src/stkutil.h
@@ -813,7 +813,9 @@ struct stk_frame_layout {
*/
struct stk_frames_info {
unsigned char id;
- unsigned char list[126];
+ struct {
+ unsigned char width, height;
+ } list[63];
unsigned int len;
};