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

@ -124,7 +124,7 @@ class Genode::Xml_attribute
* null-termination into account.
*/
max_len = min(max_len, _tokens.name.len() + 1);
strncpy(dst, _tokens.name.start(), max_len);
copy_cstring(dst, _tokens.name.start(), max_len);
}
typedef String<64> Name;
@ -198,7 +198,7 @@ class Genode::Xml_attribute
void value(char *dst, size_t max_len) const __attribute__((deprecated))
{
with_raw_value([&] (char const *start, size_t length) {
Genode::strncpy(dst, start, min(max_len, length + 1)); });
copy_cstring(dst, start, min(max_len, length + 1)); });
}
/**