summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2014-08-05 08:22:26 +0000
committerSteven Barth <steven@midlink.org>2014-08-05 12:00:53 +0200
commite4aebda4d774d0b92f4c95c4490745aaedf4cd35 (patch)
tree1f7ee7ded9d387ad9fd6f9886263e43abf906773
parent4f5b41cf789fcc30e142dfdb1123a8adc12112d5 (diff)
netifd: fix incorrect number of bytes memset in clear_if_addr
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>
-rw-r--r--interface-ip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 587826a..8d4434b 100644
--- 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;
}