Replace Genode::strncpy by Genode::copy_cstring

- Since Genode::strncpy is not 100% compatible with the POSIX
  strncpy function, better use a distinct name.

- Remove bogus return value from the function, easing the potential
  enforcement of mandatory return-value checks later.

Fixes #3752
This commit is contained in:
Norman Feske
2020-05-11 16:10:27 +02:00
committed by Christian Helmuth
parent 0f27d139bd
commit b078224753
64 changed files with 114 additions and 117 deletions

View File

@@ -222,10 +222,10 @@ void Http::parse_uri(::String const &u)
for (i = 0; i < length && uri[i] != '/'; i++) ;
_heap.alloc(i + 1, (void**)&_host);
Genode::strncpy(_host, uri, i + 1);
copy_cstring(_host, uri, i + 1);
_heap.alloc(length - i + 1, (void**)&_path);
Genode::strncpy(_path, uri + i, length - i + 1);
copy_cstring(_path, uri + i, length - i + 1);
/* look for port */
size_t len = Genode::strlen(_host);

View File

@@ -743,8 +743,8 @@ class Wm::Nitpicker::Session_component : public Rpc_object<Nitpicker::Session>,
{
char sanitized_title[command.title.title.capacity()];
Genode::strncpy(sanitized_title, command.title.title.string(),
sizeof(sanitized_title));
Genode::copy_cstring(sanitized_title, command.title.title.string(),
sizeof(sanitized_title));
for (char *c = sanitized_title; *c; c++)
if (*c == '"')