Merge pull request #796 from gebart/core-net-ip-buffer-overflow-fix

core/net/ip: Prevent (tiny) buffer overflow in resolv_found()
This commit is contained in:
Adam Dunkels 2014-10-02 13:52:05 +02:00
commit fd5e79d0db

View File

@ -1455,7 +1455,7 @@ resolv_found(char *name, uip_ipaddr_t * ipaddr)
val >>= 4;
append_str[1] = (((val & 0xF) > 9) ? 'a' : '0') + (val & 0xF);
strncat(resolv_hostname, append_str,
sizeof(resolv_hostname) - strlen(resolv_hostname));
sizeof(resolv_hostname) - strlen(resolv_hostname) - 1); /* -1 in order to fit the terminating null byte. */
}
/* Re-add the .local suffix */