diff --git a/repos/base/include/util/string.h b/repos/base/include/util/string.h index 90f8587827..b5d69ba411 100644 --- a/repos/base/include/util/string.h +++ b/repos/base/include/util/string.h @@ -592,7 +592,7 @@ class Genode::String void out_string(char const *str, size_t n) override { - while (n-- > 0 && _capacity_left()) + while (n-- > 0 && _capacity_left() && *str) _append(*str++); } }; diff --git a/repos/base/run/log.run b/repos/base/run/log.run index 2f5ed2fc3b..d70835805c 100644 --- a/repos/base/run/log.run +++ b/repos/base/run/log.run @@ -36,5 +36,6 @@ compare_output_to { [init -> test-log] negative hex char: 0xfe [init -> test-log] positive hex char: 0x02 [init -> test-log] multiarg string: "parent -> child.7" +[init -> test-log] String(Hex(3)): 0x3 [init -> test-log] Test done. } diff --git a/repos/base/src/test/log/main.cc b/repos/base/src/test/log/main.cc index 45dd6fd5f0..395fedd04c 100644 --- a/repos/base/src/test/log/main.cc +++ b/repos/base/src/test/log/main.cc @@ -30,5 +30,8 @@ void Component::construct(Genode::Env &env) typedef String<128> Label; log("multiarg string: ", Label(Char('"'), "parent -> child.", 7, Char('"'))); + String<32> hex(Hex(3)); + log("String(Hex(3)): ", hex); + log("Test done."); }