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>
This commit is contained in:
João Valverde 2017-10-29 12:21:27 +00:00 committed by João Valverde
parent 7507b11ec4
commit fe8d897e25
1 changed files with 3 additions and 6 deletions

View File

@ -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;
g_snprintf(buf,buf_len,"LID: %u", *(guint16 *)addr->data);
memcpy((void *)&lid_number, addr->data, sizeof lid_number);
g_snprintf(buf,buf_len,"LID: %u",lid_number);
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_)