Don't use uint_to_str_back when you need guint32_to_str_buf.

It will end up eventually crashing column buffers because memory
behind the address is trounced.

Change-Id: Id6b5a42effc503e4b8bf5e1deb2135241e2893f3
Reviewed-on: https://code.wireshark.org/review/22563
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2017-07-08 22:46:52 -04:00
parent ffb8bbd372
commit c2ebb62e7e
5 changed files with 12 additions and 16 deletions

View File

@ -820,6 +820,8 @@ libwireshark.so.0 libwireshark0 #MINVER#
guids_init@Base 1.9.1
guids_resolve_guid_to_str@Base 1.9.1
guint8_to_hex@Base 2.3.0
guint32_to_str_buf@Base 2.4.0~rc2
guint64_to_str_buf@Base 2.4.0~rc2
h225_RasMessage_vals@Base 1.9.1
h225_ReleaseCompleteReason_vals@Base 1.9.1
h245_set_h223_add_lc_handle@Base 1.9.1

View File

@ -785,12 +785,10 @@ static int dissect_devicenet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
static int devicenet_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
guint8 addrdata = *((const guint8*)addr->data) & 0x3F;
gchar *start_buf = buf;
const guint8 *addrdata = (const guint8 *)addr->data;
buf = uint_to_str_back(buf, addrdata);
*buf = '\0';
return (int)(buf-start_buf+1);
guint32_to_str_buf(*addrdata, buf, buf_len);
return (int)strlen(buf);
}
static int devicenet_addr_str_len(const address* addr _U_)

View File

@ -257,14 +257,12 @@ static int dissect_j1939(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
return tvb_captured_length(tvb);
}
static int J1939_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
static int J1939_addr_to_str(const address* addr, gchar *buf, int buf_len)
{
const guint8 *addrdata = (const guint8 *)addr->data;
gchar *start_buf = buf;
buf = uint_to_str_back(buf, *addrdata);
*buf = '\0';
return (int)(buf-start_buf+1);
guint32_to_str_buf(*addrdata, buf, buf_len);
return (int)strlen(buf);
}
static int J1939_addr_str_len(const address* addr _U_)

View File

@ -109,8 +109,8 @@ WS_DLL_PUBLIC gchar* signed_time_secs_to_str(wmem_allocator_t *scope, const gint
WS_DLL_PUBLIC gchar* unsigned_time_secs_to_str(wmem_allocator_t *scope, const guint32);
WS_DLL_PUBLIC gchar* signed_time_msecs_to_str(wmem_allocator_t *scope, gint32 time_val);
extern void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
extern void guint64_to_str_buf(guint64 u, gchar *buf, int buf_len);
WS_DLL_PUBLIC void guint32_to_str_buf(guint32 u, gchar *buf, int buf_len);
WS_DLL_PUBLIC void guint64_to_str_buf(guint64 u, gchar *buf, int buf_len);
WS_DLL_PUBLIC gchar* rel_time_to_str(wmem_allocator_t *scope, const nstime_t*);
WS_DLL_PUBLIC gchar* rel_time_to_secs_str(wmem_allocator_t *scope, const nstime_t*);

View File

@ -1853,11 +1853,9 @@ static int dissect_irda(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, voi
static int irda_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
{
const guint8 *addrdata = (const guint8 *)addr->data;
gchar *start_buf = buf;
buf = uint_to_str_back(buf, *addrdata);
*buf = '\0';
return (int)(buf-start_buf+1);
guint32_to_str_buf(*addrdata, buf, buf_len);
return (int)strlen(buf);
}
static int irda_addr_str_len(const address* addr _U_)