diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2011-11-17 15:57:44 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2011-11-17 15:57:44 +0000 |
commit | a71316964f899c1d97ea84b419304cf5612c908e (patch) | |
tree | 7a0c216bd53f6067591e4d0ecf05f873b6561b1f /epan/proto.c | |
parent | 67d0be7973cd5fff3c52aec2a1a14959cdb73eba (diff) |
Fix crash caused by trying to apply a field of type BASE_CUSTOM as a column. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6503.
svn path=/trunk/; revision=39902
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c index debc19cb57..f677b10f90 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -3820,7 +3820,9 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence, case FT_FRAMENUM: u_integer = fvalue_get_uinteger(&finfo->value); if (hfinfo->strings) { - if (hfinfo->display & BASE_RANGE_STRING) { + if (hfinfo->display & BASE_CUSTOM) { + g_snprintf(result+offset_r, size-offset_r, "%u", u_integer); + } else if (hfinfo->display & BASE_RANGE_STRING) { g_strlcpy(result+offset_r, rval_to_str(u_integer, hfinfo->strings, "%u"), size-offset_r); } else if (hfinfo->display & BASE_EXT_STRING) { g_strlcpy(result+offset_r, val_to_str_ext(u_integer, (value_string_ext *) (hfinfo->strings), "%u"), size-offset_r); @@ -3852,7 +3854,7 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence, offset_r = (int)strlen(result); break; case FT_EUI64: - offset_r += (int)g_strlcpy(result+offset_r, eui64_to_str(fvalue_get_integer64(&finfo->value)), size-offset_r); + offset_r += (int)g_strlcpy(result+offset_r, eui64_to_str(fvalue_get_integer64(&finfo->value)), size-offset_r); break; /* XXX - make these just FT_INT? */ case FT_INT8: @@ -3861,7 +3863,9 @@ proto_custom_set(proto_tree* tree, const int field_id, gint occurrence, case FT_INT32: integer = fvalue_get_sinteger(&finfo->value); if (hfinfo->strings) { - if (hfinfo->display & BASE_RANGE_STRING) { + if (hfinfo->display & BASE_CUSTOM) { + g_snprintf(result+offset_r, size-offset_r, "%d", integer); + } else if (hfinfo->display & BASE_RANGE_STRING) { g_strlcpy(result+offset_r, rval_to_str(integer, hfinfo->strings, "%d"), size-offset_r); } else if (hfinfo->display & BASE_EXT_STRING) { g_strlcpy(result+offset_r, val_to_str_ext(integer, (value_string_ext *) (hfinfo->strings), "%d"), size-offset_r); |