libdwfl: fix potential NULL pointer dereference when reading link map
authorOmar Sandoval <osandov@fb.com>
Thu, 10 Jun 2021 00:45:57 +0000 (17:45 -0700)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 10 Jun 2021 00:45:57 +0000 (00:45 +0000)
commit828024afc517e266f3226b469ba33f372b401821
tree606de4bf81c6cd036eccec8db3de306fb885b4e8
parentab38d167c40c995d4b3c3a2ac1347f9f2be9c810
libdwfl: fix potential NULL pointer dereference when reading link map

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>
libdwfl/ChangeLog
libdwfl/link_map.c