From 6a513d01a10e3b35ea06c2c26aab7558fd57843f Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 4 Oct 2024 20:11:43 +0100 Subject: [PATCH] EFname.c: potential dereference of a null pointer Theoretical NULL pointer deref, assumes no iteration occurs. Seems like false positive from incorrect caller use, from passing suffix==NULL. SonarCloud Access to field 'hn_parent' results in a dereference of a null pointer (loaded from variable 'prev') https://sonarcloud.io/project/issues?open=AZJB167jNGfDNup0RjGu&id=dlmiles_magic --- extflat/EFname.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extflat/EFname.c b/extflat/EFname.c index a8ff4256..035a6d81 100644 --- a/extflat/EFname.c +++ b/extflat/EFname.c @@ -189,7 +189,8 @@ EFHNConcat(prefix, suffix) else firstNew = new; } - prev->hn_parent = prefix; + if (prev) + prev->hn_parent = prefix; return firstNew; }