aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-07-08 22:46:52 -0400
committerMichael Mann <mmann78@netscape.net>2017-07-09 19:54:35 +0000
commitc2ebb62e7e2adca72b932276102ee0a293b9a4ff (patch)
treea793883e1b49caf742fafbbb57001d7b0bbac13f
parentffb8bbd37227f466d228f20ae30b87504d4e1760 (diff)
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>
-rw-r--r--debian/libwireshark0.symbols2
-rw-r--r--epan/dissectors/packet-devicenet.c8
-rw-r--r--epan/dissectors/packet-j1939.c8
-rw-r--r--epan/to_str.h4
-rw-r--r--plugins/irda/packet-irda.c6
5 files changed, 12 insertions, 16 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols
index e791bfefac..8761dafe7e 100644
--- a/debian/libwireshark0.symbols
+++ b/debian/libwireshark0.symbols
@@ -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
diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c
index 18a0453b9d..747d34894c 100644
--- a/epan/dissectors/packet-devicenet.c
+++ b/epan/dissectors/packet-devicenet.c
@@ -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_)
diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c
index c1061368e7..6a160382a9 100644
--- a/epan/dissectors/packet-j1939.c
+++ b/epan/dissectors/packet-j1939.c
@@ -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_)
diff --git a/epan/to_str.h b/epan/to_str.h
index 8d53ee9141..3fa71f2f52 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -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*);
diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c
index 52b28812df..7fff28544f 100644
--- a/plugins/irda/packet-irda.c
+++ b/plugins/irda/packet-irda.c
@@ -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_)