ptrace_write_string: the terminating NUL fix was reverted by mistake.

This commit is contained in:
Todd C. Miller
2022-05-14 13:05:00 -06:00
parent cb95b75ffa
commit 3238c43f92

View File

@@ -498,8 +498,10 @@ ptrace_write_string(pid_t pid, unsigned 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(unsigned long);
}
}