diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-03-14 13:41:12 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-03-14 13:41:12 (GMT) |
commit | f0f33c394b97341e824b5fdf62707fcd25ef84cc (patch) | |
tree | 4835e4ce1164749f205ab5e6738c17629b90ce95 | |
parent | f72bfc72205366f2f877fef379c79c9a2a1cce03 (diff) | |
download | libnl-f0f33c394b97341e824b5fdf62707fcd25ef84cc.zip libnl-f0f33c394b97341e824b5fdf62707fcd25ef84cc.tar.gz libnl-f0f33c394b97341e824b5fdf62707fcd25ef84cc.tar.bz2 |
addr: Reset unused portion of binary address in nl_addr_set_binary_addr()
memset() the binary address before overwriting it with new data
to avoid leaving around old portions of the address.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r-- | lib/addr.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -766,7 +766,10 @@ int nl_addr_set_binary_addr(struct nl_addr *addr, void *buf, size_t len) return -NLE_RANGE; addr->a_len = len; - memcpy(addr->a_addr, buf, len); + memset(addr->a_addr, 0, addr->a_maxsize); + + if (len) + memcpy(addr->a_addr, buf, len); return 0; } |