From fd8a209da22c4a16fd5bdd15aa87309467ef3138 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 15 Aug 2019 10:42:08 +0200 Subject: [PATCH] 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). --- repos/libports/src/lib/libc/socket_fs_plugin.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc index 559762bee..db5354e96 100644 --- a/repos/libports/src/lib/libc/socket_fs_plugin.cc +++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc @@ -357,7 +357,7 @@ struct Socket_fs::Sockaddr_string : String { 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 if (!at) throw Address_conversion_failed(); - strncpy(port.base(), ++at, port.capacity()); + Genode::strncpy(port.base(), ++at, port.capacity()); return port; }