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:
committed by
Christian Helmuth
parent
0f27d139bd
commit
b078224753
@@ -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);
|
||||
|
||||
@@ -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 == '"')
|
||||
|
||||
Reference in New Issue
Block a user