diff options
author | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2011-05-05 16:41:52 +0000 |
---|---|---|
committer | Jakub Zawadzki <darkjames-ws@darkjames.pl> | 2011-05-05 16:41:52 +0000 |
commit | 892da10a29dc99c8f8adc669319650c2d3a6f1eb (patch) | |
tree | dc985d817fb032892dc6ee8a3301856d0499c54f | |
parent | df3cd034b8fbf3cdc2918144345f4ec21e84ca98 (diff) | |
download | wireshark-892da10a29dc99c8f8adc669319650c2d3a6f1eb.tar.gz |
Subtract (not add!) preamble length from remaining buffer length.
svn path=/trunk/; revision=36998
-rw-r--r-- | epan/address_to_str.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c index e65aa0e220..0beb50882c 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -251,8 +251,9 @@ ib_addr_to_str_buf( const address *addr, gchar *buf, int buf_len){ if (addr->len >= 16) { /* GID is 128bits */ #define PREAMBLE_STR_LEN (sizeof("GID: ") - 1) g_snprintf(buf,buf_len,"GID: "); - if ( inet_ntop(AF_INET6, addr->data, buf + PREAMBLE_STR_LEN, - buf_len + PREAMBLE_STR_LEN) == NULL ) /* Returns NULL if no space and does not touch buf */ + if (buf_len < (int)PREAMBLE_STR_LEN || + inet_ntop(AF_INET6, addr->data, buf + PREAMBLE_STR_LEN, + buf_len - PREAMBLE_STR_LEN) == NULL ) /* Returns NULL if no space and does not touch buf */ g_snprintf ( buf, buf_len, BUF_TOO_SMALL_ERR ); /* Let the unexpected value alert user */ } else { /* this is a LID (16 bits) */ guint16 lid_number = *((guint16*) addr->data); |