Fix handling of headers in body part.

Check whether the unfolded-and-compacted header has only printable
characters, not whether the full header does - the full header may
include LWSP, which includes HT, CR, and LF, none of which are
considered "printable", so valid headers were being treated as not being
headers, causing mis-dissection of some packets.

We don't need to split the header name from the value -
is_known_multipart_header() stops comparison at the end of the header
name.

Change-Id: I96e4ac0b69df726b984ee7faeea19eda18be223c
Reviewed-on: https://code.wireshark.org/review/33417
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
This commit is contained in:
Guy Harris 2019-05-29 10:31:13 -07:00
parent 01d20982c3
commit 78a106dc2a
1 changed files with 1 additions and 4 deletions

View File

@ -44,7 +44,6 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/media_params.h>
@ -614,12 +613,10 @@ process_body_part(proto_tree *tree, tvbuff_t *tvb,
} else {
gint hf_index;
/* Split header name from header value */
header_str[colon_offset] = '\0';
hf_index = is_known_multipart_header(header_str, colon_offset);
if (hf_index == -1) {
if(isprint_string(hdr_str)) {
if(isprint_string(header_str)) {
proto_tree_add_format_text(subtree, tvb, offset, next_offset - offset);
} else {
/* if the header name is unkown and not printable, break and add complete line to the body */