You cannot just make the "len" field of a GByteArray larger, if there's

no data to back that length; you can only make it smaller.

svn path=/trunk/; revision=37236
This commit is contained in:
Guy Harris 2011-05-18 07:20:45 +00:00
parent fc65604b7e
commit aa392a40fe
1 changed files with 6 additions and 1 deletions

View File

@ -4096,7 +4096,12 @@ proto_item_set_len(proto_item *pi, const gint length)
DISSECTOR_ASSERT(length >= 0);
fi->length = length;
if (fi->value.ftype->ftype == FT_BYTES)
/*
* You cannot just make the "len" field of a GByteArray
* larger, if there's no data to back that length;
* you can only make it smaller.
*/
if (fi->value.ftype->ftype == FT_BYTES && length <= fi->length)
fi->value.value.bytes->len = length;
}