projects
/
oweals
/
netifd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4f5b41c
)
netifd: fix incorrect number of bytes memset in clear_if_addr
author
Hans Dedecker
<dedeckeh@gmail.com>
Tue, 5 Aug 2014 08:22:26 +0000
(08:22 +0000)
committer
Steven Barth
<steven@midlink.org>
Tue, 5 Aug 2014 10:00:53 +0000
(12:00 +0200)
Fix clear_if_addr for IPv6 addresses as an incorrect number of bytes were memset due to wrong sizeof argument
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
interface-ip.c
patch
|
blob
|
history
diff --git
a/interface-ip.c
b/interface-ip.c
index 587826a996cd708d094b00fc658fcaf3a4919dbc..8d4434b42cea3d28f3cccde5ceba273004cd5369 100644
(file)
--- a/
interface-ip.c
+++ b/
interface-ip.c
@@
-75,8
+75,8
@@
clear_if_addr(union if_addr *a, int mask)
uint8_t m_clear = (1 << (m_bytes * 8 - mask)) - 1;
uint8_t *p = (uint8_t *) a;
- if (m_bytes < sizeof(a))
- memset(p + m_bytes, 0, sizeof(a) - m_bytes);
+ if (m_bytes < sizeof(
*
a))
+ memset(p + m_bytes, 0, sizeof(
*
a) - m_bytes);
p[m_bytes - 1] &= ~m_clear;
}