logging: net: Avoid copying too much data
Use strncpy() in order to avoid copying extra data to hostname buffer. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
ecf3bdb5b3
commit
ea1bed4744
1 changed files with 1 additions and 1 deletions
|
@ -111,7 +111,7 @@ static int do_net_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NET_HOSTNAME_ENABLE)) {
|
if (IS_ENABLED(CONFIG_NET_HOSTNAME_ENABLE)) {
|
||||||
(void)memcpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
|
(void)strncpy(hostname, net_hostname_get(), MAX_HOSTNAME_LEN);
|
||||||
|
|
||||||
} else if (IS_ENABLED(CONFIG_NET_IPV6) &&
|
} else if (IS_ENABLED(CONFIG_NET_IPV6) &&
|
||||||
server_addr.sa_family == AF_INET6) {
|
server_addr.sa_family == AF_INET6) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue