[PATCH] [elf] Fix possible null-pointer dereference.

Dmitry Chestnyh d.chestnyh@omp.ru
Thu Mar 31 16:20:48 GMT 2022


This issue was found by SVACE static analyzer.
Dereference can appear at line 2223 and there are no
obvious checks of `name` ptr value.
Jump to label `no_file` from elf/dl-load.c:2066
can trigger it.
---
 elf/dl-load.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 892e8ef2f6..0bced6cd8a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2271,6 +2271,7 @@ _dl_map_object (struct link_map *loader, const char *name,
 	     have.  */
 	  static const Elf_Symndx dummy_bucket = STN_UNDEF;
 
+	  assert(name != NULL);
 	  /* Allocate a new object map.  */
 	  if ((name_copy = __strdup (name)) == NULL
 	      || (l = _dl_new_object (name_copy, name, type, loader,
-- 
2.25.1



More information about the Libc-alpha mailing list