diff --git a/src/exec_ptrace.c b/src/exec_ptrace.c index c648680c7..b2bda375b 100644 --- a/src/exec_ptrace.c +++ b/src/exec_ptrace.c @@ -465,8 +465,10 @@ ptrace_write_string(pid_t pid, long addr, const char *str) __func__, (int)pid, addr, (int)sizeof(u.buf), u.buf); debug_return_size_t(-1); } - if (*str == '\0') + if ((u.word & 0xff) == 0) { + /* If the last byte we wrote is a NUL we are done. */ debug_return_size_t(str - str0 + 1); + } addr += sizeof(long); } }