aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-03-12 01:47:02 +0100
committerMichael Mann <mmann78@netscape.net>2015-03-12 00:59:31 +0000
commita9c75ca3c8251d465d6350f1783ab3c972979a2f (patch)
treed15849604baf7cefe18ddde2c725050920b4431a /epan/ftypes
parent0bec88518f22aca076e69654d029c96fa050f003 (diff)
Avoid abort on zero-length fields
Since commit v1.99.4rc0-70-g0bec885 (Remove use of sprintf for ftype string formatting), Wireshark aborts with "Null pointer passed to bytes_to_hexstr_punct()". This happened with a SSL capture where the ssl.handshake.extensions_padding_data had a zero length. Fix it by producing a zero-length string instead (as done by the previous implementation). Change-Id: I711d786a9ae692eb44c5e49a30d5fea41c5af31e Reviewed-on: https://code.wireshark.org/review/7649 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/ftypes')
-rw-r--r--epan/ftypes/ftype-bytes.c3
-rw-r--r--epan/ftypes/ftype-tvbuff.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c
index 5f54a44f5c..2bacdfd8b9 100644
--- a/epan/ftypes/ftype-bytes.c
+++ b/epan/ftypes/ftype-bytes.c
@@ -158,7 +158,8 @@ bytes_to_repr(fvalue_t *fv, ftrepr_t rtype _U_, int field_display, char *buf)
break;
}
- buf = bytes_to_hexstr_punct(buf, fv->value.bytes->data, fv->value.bytes->len, separator);
+ if (fv->value.bytes->len)
+ buf = bytes_to_hexstr_punct(buf, fv->value.bytes->data, fv->value.bytes->len, separator);
*buf = '\0';
}
diff --git a/epan/ftypes/ftype-tvbuff.c b/epan/ftypes/ftype-tvbuff.c
index 38cbe15b61..e09bab319a 100644
--- a/epan/ftypes/ftype-tvbuff.c
+++ b/epan/ftypes/ftype-tvbuff.c
@@ -147,7 +147,8 @@ val_to_repr(fvalue_t *fv, ftrepr_t rtype, int field_display _U_, char * volatile
TRY {
length = tvb_length(fv->value.tvb);
- buf = bytes_to_hexstr_punct(buf, tvb_get_ptr(fv->value.tvb, 0, length), length, ':');
+ if (length)
+ buf = bytes_to_hexstr_punct(buf, tvb_get_ptr(fv->value.tvb, 0, length), length, ':');
*buf = '\0';
}
CATCH_ALL {