[elf] Fix possible null-pointer dereference.

Message ID 20220331162048.449551-1-d.chestnyh@omp.ru
State New
Series [elf] Fix possible null-pointer dereference. |


Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Dmitry Chestnyh March 31, 2022, 4:20 p.m. UTC
  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,