bug-cfengine
[Top][All Lists]
Advanced

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

cfengine 1.6.3 src/image.c: uninitialised variable lastnode


From: Sergio Gelato
Subject: cfengine 1.6.3 src/image.c: uninitialised variable lastnode
Date: Tue, 12 Feb 2002 20:38:35 +0100
User-agent: Mutt/1.2.5i

This bug was already reported on 1999-08-18 by Roar Thronæs, but is still
unfixed in 1.6.3. Is anyone collecting and distributing maintenance fixes
for cfengine 1?

In function ImageCopy() (src/image.c) the local variable lastnode is never
initialised. When it is passed as an input argument to IsWildItemIn(), an 
access violation results.

I'm tentatively adding

   if (lastnode = strrchr(sourcefile,'/'))
      lastnode++;
   else
      lastnode = sourcefile;

just before the calls to IsWildItemIn(), but would like an opinion as
to whether this is the correct fix.

I'm not too impressed with the coding style in src/link.c:

for (lastnode = from+strlen(from); *lastnode != '/'; lastnode--)
   {
   }

lastnode++;

not least because there is no immediately obvious guarantee that the
string does in fact contain a '/'.




reply via email to

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