dect
/
libnl
Archived
13
0
Fork 0

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>
This commit is contained in:
Thomas Graf 2013-03-14 14:41:12 +01:00
parent f72bfc7220
commit f0f33c394b
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}