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.
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, name, mask);
goto pageflags_fail;
}
--
2.25.1