When read_addrs() was moved into file scope, there was a mistake in
converting "buffer" from a closure variable to a parameter: we are
checking whether the pointer argument is NULL, not whether the buffer
itself is NULL. This causes a NULL pointer dereference when we try
to use the NULL buffer later.
Fixes:
3bf41d458fb6 ("link_map: Pull read_addrs() into file scope")
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
+2021-06-09 Omar Sandoval <osandov@fb.com>
+
+ * link_map.c (read_addrs): Fix potential NULL pointer dereference.
+
2021-04-19 Martin Liska <mliska@suse.cz>
* dwfl_frame.c (dwfl_attach_state): Use startswith.
Dwfl *dwfl = closure->dwfl;
/* Read a new buffer if the old one doesn't cover these words. */
- if (buffer == NULL
+ if (*buffer == NULL
|| vaddr < *read_vaddr
|| vaddr - (*read_vaddr) + nb > *buffer_available)
{