mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +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:
committed by
Norman Feske
parent
1936667a53
commit
84e476facb
@ -683,7 +683,7 @@ class Genode::Xml_node
|
|||||||
char const *src = content_base();
|
char const *src = content_base();
|
||||||
size_t src_len = content_size();
|
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);
|
Decoded_character const decoded_character(src, src_len);
|
||||||
|
|
||||||
@ -703,8 +703,8 @@ class Genode::Xml_node
|
|||||||
STRING decoded_content() const
|
STRING decoded_content() const
|
||||||
{
|
{
|
||||||
char buf[STRING::capacity() + 1];
|
char buf[STRING::capacity() + 1];
|
||||||
size_t const len = decoded_content(buf, sizeof(buf));
|
size_t const len = decoded_content(buf, sizeof(buf) - 1);
|
||||||
buf[min(len, STRING::capacity())] = 0;
|
buf[min(len, sizeof(buf) - 1)] = 0;
|
||||||
return STRING(Cstring(buf));
|
return STRING(Cstring(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user