aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-multipart.c
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2007-07-17 11:54:22 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2007-07-17 11:54:22 +0000
commit6bbe9bd5d6ea7fceda9961193f7ead9d141fb237 (patch)
treefbf4af06fe629c5671e2e3acedac8015b54eee09 /epan/dissectors/packet-multipart.c
parent698426f6b88f2129c19006283568afd600e554b1 (diff)
Avoid an infinite loop (on malformed packet)
svn path=/trunk/; revision=22333
Diffstat (limited to 'epan/dissectors/packet-multipart.c')
-rw-r--r--epan/dissectors/packet-multipart.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c
index e2a9456c86..14ab2627c0 100644
--- a/epan/dissectors/packet-multipart.c
+++ b/epan/dissectors/packet-multipart.c
@@ -622,7 +622,12 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb, const guint8 *boundary,
char *hdr_str;
char *header_str;
+ /* Look for the end of the header (denoted by cr) */
next_offset = imf_find_field_end(tvb, offset, tvb_length_remaining(tvb, offset), &last_field);
+ /* If cr not found, won't have advanced - get out to avoid infinite loop! */
+ if (next_offset == offset) {
+ break;
+ }
hdr_str = tvb_get_ephemeral_string(tvb, offset, next_offset - offset);