Skip to content

Commit 7d2d652

Browse files
KONRAD Fredericstsquad
authored andcommitted
semihosting: don't send the trailing '\0'
Don't send the trailing 0 from the string. Signed-off-by: KONRAD Frederic <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Message-Id: <[email protected]>
1 parent 619985e commit 7d2d652

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hw/semihosting/console.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ static GString *copy_user_string(CPUArchState *env, target_ulong addr)
5252

5353
do {
5454
if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) {
55-
s = g_string_append_c(s, c);
55+
if (c) {
56+
s = g_string_append_c(s, c);
57+
}
5658
} else {
5759
qemu_log_mask(LOG_GUEST_ERROR,
5860
"%s: passed inaccessible address " TARGET_FMT_lx,

0 commit comments

Comments
 (0)