[PATCH] Fix deref-of-null in handle_file_note()
Maks Mishin
maks.mishinfz@gmail.com
Mon Jul 1 19:47:05 GMT 2024
After having been assigned to a NULL value at dwfl_segment_report_module.c:200,
pointer 'retval' is dereferenced at dwfl_segment_report_module.c:208 by calling function 'strcmp'.
Found by RASU JSC.
Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
libdwfl/dwfl_segment_report_module.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c
index dc34e0ae..976d7b79 100644
--- a/libdwfl/dwfl_segment_report_module.c
+++ b/libdwfl/dwfl_segment_report_module.c
@@ -205,7 +205,8 @@ handle_file_note (GElf_Addr module_start, GElf_Addr module_end,
return NULL;
if (mix == firstix)
retval = fptr;
- if (firstix < mix && mix <= lastix && strcmp (fptr, retval) != 0)
+ if (retval != NULL)
+ if (firstix < mix && mix <= lastix && strcmp (fptr, retval) != 0)
return NULL;
fptr = fnext + 1;
}
--
2.30.2
More information about the Elfutils-devel
mailing list