aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-05-29 11:23:42 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-05-29 11:23:42 +0000
commit7c07e00f1de99d60304350ea4f00c22958344b3b (patch)
treea09a46f0e806c08a28080e0b5ee45539256ac640 /epan/proto.c
parentacaf8730bec1eddc0769c04b6db039fdb42395ce (diff)
downloadwireshark-7c07e00f1de99d60304350ea4f00c22958344b3b.tar.gz
wireshark-7c07e00f1de99d60304350ea4f00c22958344b3b.tar.bz2
wireshark-7c07e00f1de99d60304350ea4f00c22958344b3b.zip
fix #11: add a [truncated] to the label, if the message to display is too long
svn path=/trunk/; revision=14477
Diffstat (limited to 'epan/proto.c')
-rw-r--r--epan/proto.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 6e2fe223fd..672e256f85 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -3109,9 +3109,15 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
case FT_STRINGZ:
case FT_UINT_STRING:
bytes = fvalue_get(&fi->value);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
- "%s: %s", hfinfo->name,
- format_text(bytes, strlen(bytes)));
+ if(strlen(bytes) > ITEM_LABEL_LENGTH) {
+ ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ "%s [truncated]: %s", hfinfo->name,
+ format_text(bytes, strlen(bytes)));
+ } else {
+ ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ "%s: %s", hfinfo->name,
+ format_text(bytes, strlen(bytes)));
+ }
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
break;