aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesus Fernandez Manzano <jesus.manzano@galgus.net>2019-10-09 07:59:33 (GMT)
committerJouni Malinen <j@w1.fi>2019-10-25 16:29:53 (GMT)
commit305369038bf554f6d76c41455a5bce9fdebba06b (patch)
tree6bed7d775ddc149044c8c772c01c9e39a6c07e75
parent00ddc1cc21a8428b87e5e3853508f27f7c5557d2 (diff)
downloadhostap-305369038bf554f6d76c41455a5bce9fdebba06b.zip
hostap-305369038bf554f6d76c41455a5bce9fdebba06b.tar.gz
hostap-305369038bf554f6d76c41455a5bce9fdebba06b.tar.bz2
wpa_supplicant: Fix arithmetic on void pointer
When using void pointers in calculations, the behavior is undefined. Arithmetic operations on 'void *' is a GNU C extension, which defines the 'sizeof(void)' to be 1. This change improves portability of the code. Signed-off-by: Jesus Fernandez Manzano <jesus.manzano@galgus.net>
-rw-r--r--wpa_supplicant/wpa_priv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index b3ad45e..f197352 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -598,7 +598,7 @@ static void wpa_priv_cmd_l2_send(struct wpa_priv_interface *iface,
}
dst_addr = buf;
- os_memcpy(&proto, buf + ETH_ALEN, 2);
+ os_memcpy(&proto, (char *) buf + ETH_ALEN, 2);
if (!wpa_priv_allowed_l2_proto(proto)) {
wpa_printf(MSG_DEBUG, "Refused l2_packet send for ethertype "
@@ -607,7 +607,8 @@ static void wpa_priv_cmd_l2_send(struct wpa_priv_interface *iface,
}
res = l2_packet_send(iface->l2[idx], dst_addr, proto,
- buf + ETH_ALEN + 2, len - ETH_ALEN - 2);
+ (unsigned char *) buf + ETH_ALEN + 2,
+ len - ETH_ALEN - 2);
wpa_printf(MSG_DEBUG, "L2 send[idx=%d]: res=%d", idx, res);
}