mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 17:52:52 +00:00
Xml_node: do not consider '0' in decoded_content
Do not leave space for a terminating '0' at the end of the dst buffer in decoded_content as the method does not write this '0'. The caller of the method shall take care of it instead. Issue #2644
This commit is contained in:
parent
1936667a53
commit
84e476facb
@ -683,7 +683,7 @@ class Genode::Xml_node
|
||||
char const *src = content_base();
|
||||
size_t src_len = content_size();
|
||||
|
||||
for (; dst_len > 1 && src_len; result_len++) {
|
||||
for (; dst_len && src_len; result_len++) {
|
||||
|
||||
Decoded_character const decoded_character(src, src_len);
|
||||
|
||||
@ -703,8 +703,8 @@ class Genode::Xml_node
|
||||
STRING decoded_content() const
|
||||
{
|
||||
char buf[STRING::capacity() + 1];
|
||||
size_t const len = decoded_content(buf, sizeof(buf));
|
||||
buf[min(len, STRING::capacity())] = 0;
|
||||
size_t const len = decoded_content(buf, sizeof(buf) - 1);
|
||||
buf[min(len, sizeof(buf) - 1)] = 0;
|
||||
return STRING(Cstring(buf));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user