diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-10-29 12:21:27 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-10-29 15:15:41 +0000 |
commit | fe8d897e2557f109b252ce83421d929c1ac039c6 (patch) | |
tree | 11fb6569a46e8e5a84041bbe573cdb7eb70a7d00 /epan/address_types.c | |
parent | 7507b11ec4440b8183a10113f5b33f56e6202c0e (diff) |
sizeof(buf) is not what you want here
Change-Id: Iaf3463006b93c9acdc27f59fcbbea92df1d2fd7d
Reviewed-on: https://code.wireshark.org/review/24164
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'epan/address_types.c')
-rw-r--r-- | epan/address_types.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/epan/address_types.c b/epan/address_types.c index f73ed932da..f416bd168d 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -418,7 +418,7 @@ static int eui64_addr_to_str(const address* addr, gchar *buf, int buf_len _U_) { buf = bytes_to_hexstr_punct(buf, (const guint8 *)addr->data, 8, ':'); *buf = '\0'; /* NULL terminate */ - return sizeof(buf) + 1; + return (int)(strlen(buf)+1); } static int eui64_str_len(const address* addr _U_) @@ -442,12 +442,9 @@ ib_addr_to_str(const address *addr, gchar *buf, int buf_len) } /* this is a LID (16 bits) */ - guint16 lid_number; - - memcpy((void *)&lid_number, addr->data, sizeof lid_number); - g_snprintf(buf,buf_len,"LID: %u",lid_number); + g_snprintf(buf,buf_len,"LID: %u", *(guint16 *)addr->data); - return sizeof(buf) + 1; // XXX this looks all kinds of wrong + return (int)(strlen(buf)+1); } static int ib_str_len(const address* addr _U_) |