diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-11-07 20:30:34 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-11-07 20:30:34 +0000 |
commit | 5123a82b3ce7e8e9128318c866aca90bef1491d6 (patch) | |
tree | da02a633d5be16d8d4e184b6caebce1169481e88 /epan/ftypes | |
parent | 4c2f1f7ccb54097c14b87e215c209e0825e5003d (diff) | |
download | wireshark-5123a82b3ce7e8e9128318c866aca90bef1491d6.tar.gz |
Fix bytes_repr_len() to correctly handle a zero-length FT_BYTES field
svn path=/trunk/; revision=19863
Diffstat (limited to 'epan/ftypes')
-rw-r--r-- | epan/ftypes/ftype-bytes.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/epan/ftypes/ftype-bytes.c b/epan/ftypes/ftype-bytes.c index 095eb67672..88c46b2e31 100644 --- a/epan/ftypes/ftype-bytes.c +++ b/epan/ftypes/ftype-bytes.c @@ -70,9 +70,15 @@ bytes_fvalue_set(fvalue_t *fv, gpointer value, gboolean already_copied) static int bytes_repr_len(fvalue_t *fv, ftrepr_t rtype _U_) { - /* 3 bytes for each byte of the byte "NN:" minus 1 byte - * as there's no trailing ":". */ - return fv->value.bytes->len * 3 - 1; + if (fv->value.bytes->len == 0) { + /* Empty array of bytes, so the representation + * is an empty string. */ + return 0; + } else { + /* 3 bytes for each byte of the byte "NN:" minus 1 byte + * as there's no trailing ":". */ + return fv->value.bytes->len * 3 - 1; + } } static int |