bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-inetutils] Multiple nodes seriously broken in Inetd.


From: Mats Erik Andersson
Subject: Re: [bug-inetutils] Multiple nodes seriously broken in Inetd.
Date: Sat, 13 Nov 2010 23:34:48 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

A proposal follows!

lördag den 13 november 2010 klockan 21:49 skrev Mats Erik Andersson detta:
> Hello all,
> 
> [...]
>
> To judge from these observations, the handling of `global_serv_node',
> `serv_node' in next_node_sep() and getconfigent() is severly messed up.
> I have been staring at this for parts of two days now, but I have not
> yet found the weak spot. The double free error is the best clue I have
> found so far. This error happens with a freshly cloned source tree,
> so it does not interfere with other defects in Inetd that I am presently
> addressing.

After a touch of inspiration, I have come up with a suggestion for patching
this calamity. The present change produces a funtional Inetd for GNU/Linux
and OpenBSD.

Since there are more than one call freeconfig() in `src/inetd.c',
I would appreciate help to conduct an analysis as to the correctness
of this single alteration. I am refering to the complete reclaim of
all allocated memory during the lifetime of Inetd. The original
authors of Inetd are kindly asked to step forward here.

Observe that the present code section is touching on code that
needs to be reverted, as was reported by me earlier today.


Best regards,

Mats

-------------------------------------------------
diff --git a/src/inetd.c b/src/inetd.c
index f5f7d32..e7d8d53 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -1165,7 +1165,10 @@ nextconfig (const char *file)
          sep->se_checked = 1;
        }
       expand_enter (sep);
-      freeconfig (sep);
+      if (serv_node)
+       free (sep->se_node);
+      else
+       freeconfig (sep);
     }
   endconfig (fconfig);
   /*

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]