mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 22:58:26 +00:00
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
@ -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)); });
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user