mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
base: print last character of unterminated strings
The last character should only be skipped if a `\0` or `\n` is found. If the string ends without such a character or the maximum line length is hit, we do not skip the last character. Fixes genodelabs/genode#4985
This commit is contained in:
parent
e78a84196d
commit
0622446f09
@ -67,17 +67,16 @@ void Genode::print_lines(char const *string, size_t len, FUNC const &func)
|
||||
string += num_indent_chars;
|
||||
|
||||
size_t line_len = 0;
|
||||
size_t skip_char = 1;
|
||||
size_t skip_char = 0;
|
||||
|
||||
for (; line_len < len; line_len++) {
|
||||
if (string[line_len] == '\0' || string[line_len] == '\n') {
|
||||
line_len++;
|
||||
skip_char = 1;
|
||||
break;
|
||||
}
|
||||
if (line_len == MAX_LINE_LEN) {
|
||||
skip_char = 0;
|
||||
if (line_len == MAX_LINE_LEN)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!line_len)
|
||||
|
Loading…
x
Reference in New Issue
Block a user