aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-05-18 07:20:45 +0000
committerGuy Harris <guy@alum.mit.edu>2011-05-18 07:20:45 +0000
commitaa392a40fe73df11dd3fafc9b70ad75b5e4dffea (patch)
tree42a8c6bf9aa78a8f710ded4a74f5da9785fe6f97 /epan/proto.c
parentfc65604b7eb7137c78df6cd2b2b419fc8c2f124b (diff)
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
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 2bde3f9abc..b343574b14 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -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;
}