Repository : ssh://git@open-mesh.org/batctl
On branch : next
commit ef41a8dff85ab2f9ecc64584ad3dee1262642cb9 Author: Sven Eckelmann sven@narfation.org Date: Tue Oct 15 18:01:08 2013 +0200
batctl: Fix static buffer for resolved mac adddress
The resolve_mac_* functions are currently not reentrant-safe because they are using ether_aton. Thus all functions returning a mac address in a similar way must also ensure that their data is in a statically allocated buffer and not on a stack.
resolve_mac_from_cache did that for the wrong buffer.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
ef41a8dff85ab2f9ecc64584ad3dee1262642cb9 functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/functions.c b/functions.c index 9e03e72..959784b 100644 --- a/functions.c +++ b/functions.c @@ -630,8 +630,8 @@ static int resolve_mac_from_cache_parse(struct ndmsg *ndmsg, size_t len_payload, static struct ether_addr *resolve_mac_from_cache(int ai_family, const void *l3addr) { - static uint8_t l3addr_tmp[16]; - struct ether_addr mac_tmp; + uint8_t l3addr_tmp[16]; + static struct ether_addr mac_tmp; struct ether_addr *mac_result = NULL; void *buf = NULL; size_t buflen;