bug-cfengine
[Top][All Lists]
Advanced

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

link.c: LinkFiles() fails to initialize some fields for copy=.


From: Sergio Gelato
Subject: link.c: LinkFiles() fails to initialize some fields for copy=.
Date: Tue, 16 Apr 2002 13:56:43 +0200
User-agent: Mutt/1.2.5i

The following bug is present in both 1.6.3 and 2.0.1.

In file src/link.c, the function LinkFiles() fills in some fields of
struct Image ip prior to calling CheckImage(). This code path is exercised
when the configuration file uses a copy= attribute in a links: section.

The following components of the struct image are accessed by CheckImage()
(and/or its child ImageCopy()) but not initialised by LinkFiles():

linktype
size

Suggested fix (please confirm, especially linktype):
        ip.linktype = 'n';
        ip.size = cfnosize;

It may be prudent to explicitly initialize _all_ components of ip to safe
values, whether they are currently needed or not.

In passing, I note an instance of poor (inconsistent) style in setting
ip.uid and ip.gid. LinkFiles() sets them to "sameowner" (and implicitly
assumes that this is valid both as an uid and as a gid), but CheckImage()
uses (uid_t)-1 and (gid_t)-1 instead. Currently this works because
sameowner == (uid_t)-1, but why two different notations? And why isn't
there a corresponding variable samegroup?



reply via email to

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