mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
libc: fix warning in socket_fs_plugin.cc
By using Genode::strncpy instead of the libc's strncpy, we cannot end up in the situation where the result lacks the zero termination (where the number of charactors equals the destination buffer size).
This commit is contained in:
parent
15b27a1e9d
commit
fd8a209da2
@ -357,7 +357,7 @@ struct Socket_fs::Sockaddr_string : String<NI_MAXHOST + NI_MAXSERV>
|
||||
{
|
||||
Host_string host;
|
||||
|
||||
strncpy(host.base(), base(), host.capacity());
|
||||
Genode::strncpy(host.base(), base(), host.capacity());
|
||||
char *at = strstr(host.base(), ":");
|
||||
if (!at)
|
||||
throw Address_conversion_failed();
|
||||
@ -374,7 +374,7 @@ struct Socket_fs::Sockaddr_string : String<NI_MAXHOST + NI_MAXSERV>
|
||||
if (!at)
|
||||
throw Address_conversion_failed();
|
||||
|
||||
strncpy(port.base(), ++at, port.capacity());
|
||||
Genode::strncpy(port.base(), ++at, port.capacity());
|
||||
|
||||
return port;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user