aboutsummaryrefslogtreecommitdiffstats
path: root/epan/addr_and_mask.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2020-04-13 23:15:58 +0200
committerGuy Harris <gharris@sonic.net>2020-04-14 08:31:11 +0000
commitd3c4dfa9eed79d100f039f7042577cadb8fcad06 (patch)
tree6698c077daaacc2219871df294375518d62a86c5 /epan/addr_and_mask.c
parentab52c76cb67169ef83750333476cff69fc0d406a (diff)
wsutil: use ws_in4_addr in tvb_get_ipv4_addr_with_prefix_len.
Instead of guint8* the used type looks more precise. Moreover there is no need to use local unions in the dissectors to switch between the actual address and address bytes. bgp, eigrp and isis-lsp dissectors have been updated accordingly. Change-Id: I7785fe4c12913a09bd31cd6ef26e53027646d35c Reviewed-on: https://code.wireshark.org/review/36836 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'epan/addr_and_mask.c')
-rw-r--r--epan/addr_and_mask.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/addr_and_mask.c b/epan/addr_and_mask.c
index 9cb059de34..c730ba082a 100644
--- a/epan/addr_and_mask.c
+++ b/epan/addr_and_mask.c
@@ -44,16 +44,16 @@ ip_get_subnet_mask(const guint32 mask_length)
*/
int
-tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset, guint8 *addr,
+tvb_get_ipv4_addr_with_prefix_len(tvbuff_t *tvb, int offset, ws_in4_addr *addr,
guint32 prefix_len)
{
- guint32 addr_len;
+ guint8 addr_len;
if (prefix_len > 32)
return -1;
addr_len = (prefix_len + 7) / 8;
- memset(addr, 0, 4);
+ *addr = 0;
tvb_memcpy(tvb, addr, offset, addr_len);
if (prefix_len % 8)
addr[addr_len - 1] &= ((0xff00 >> (prefix_len % 8)) & 0xff);