On 2022/10/24 18:35, Matias Ezequiel Vara Larsen wrote:
When read_string() fails, error() dereferences the name variable to
print the
nullchar that the variable points to. However, name points to a nullchar that
is not in crash's memory-space thus triggering a segmentation fault. This
commit replaces %s in the error message with %p so the address is printed
instead.
Thanks for the report and patch.
I think that 'nullchar' means null-terminated string and it's a bit
confusing, so I will replace it with 'string'.
Signed-off-by: Matias Ezequiel Vara Larsen <matias.vara(a)vates.fr>
---
memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/memory.c b/memory.c
index c80ef61..8a1c055 100644
--- a/memory.c
+++ b/memory.c
@@ -6599,7 +6599,7 @@ page_flags_init_from_pageflag_names(void)
}
if (!read_string((ulong)name, namebuf, BUFSIZE-1)) {
- error(INFO, "failed to read pageflag_names entry (i: %d name: \"%s\"
mask: %ld)\n",
+ error(INFO, "failed to read pageflag_names entry (i: %d name: \"%p\"
mask: %ld)\n",
I will replace \"%p\" with %lx according to crash's convention.
With the changes above,
Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
I can fix them when merging in this case, you don't need to resend.
Please wait for another ack.
Thanks,
Kazu