public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] segment: Fix dangling pointer
@ 2024-03-28 20:29 Maks Mishin
  2024-03-28 21:04 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Maks Mishin @ 2024-03-28 20:29 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Maks Mishin

Pointer 'lookup_module' which is a field of the structure 'Dwfl'
freed at segment.c:88 is not overwritten, but it is usually overwritten
after free.

Found by RASU JSC.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
 libdwfl/segment.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libdwfl/segment.c b/libdwfl/segment.c
index f6a3e84e..af76f2f8 100644
--- a/libdwfl/segment.c
+++ b/libdwfl/segment.c
@@ -86,6 +86,7 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx)
 	  if (unlikely (dwfl->lookup_module == NULL))
 	    {
 	      free (old);
+	      old = NULL;
 	      return true;
 	    }
 	}
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-03 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 20:29 [PATCH] segment: Fix dangling pointer Maks Mishin
2024-03-28 21:04 ` Mark Wielaard
     [not found]   ` <CAEh9MGSacFTTxckO5sv8nzfAzxGRCrdSEQUzVxO_wX2-5ReYsA@mail.gmail.com>
2024-04-03 20:28     ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).