help-cfengine
[Top][All Lists]
Advanced

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

[PATCH] Apparently fixes potential DoS


From: Adrian Phillips
Subject: [PATCH] Apparently fixes potential DoS
Date: 05 Feb 2002 13:19:35 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

This ones from Debian's 1.6.3 package.

diff -urN cfengine-2.0.a16/src/tidy.c cfengine-2.0.a16.new/src/tidy.c
--- cfengine-2.0.a16/src/tidy.c Wed Jan  9 15:04:09 2002
+++ cfengine-2.0.a16.new/src/tidy.c     Fri Feb  1 09:58:33 2002
@@ -73,6 +73,7 @@
    {
    if (LOGTIDYHOMEFILES)
       {
+      int tempfd;
       strcpy(VLOGFILE,name);
       strcat(VLOGFILE,"/.cfengine.rm");
       
@@ -83,11 +84,16 @@
         {
         Debug("Pre-existing object %s could not be removed\n",VLOGFILE);
         }
-      
-      if ((VLOGFP = fopen(VLOGFILE,"w")) == NULL)         /* log deleted files 
for each user */
+      else if((tempfd = open(VLOGFILE, O_CREAT|O_EXCL|O_WRONLY)) < 0)
         {
         snprintf(OUTPUT,bufsize*2,"Couldn't open a file %s\n",VLOGFILE);
-        CfLog(cferror,OUTPUT,"fopen");
+     CfLog(cferror,OUTPUT,"open");
+     VLOGFP = stderr;
+     }
+      else if ((VLOGFP = fdopen(tempfd,"w")) == NULL)   
+     {
+     sprintf(OUTPUT,"Couldn't open a file %s\n",VLOGFILE);
+     CfLog(cferror,OUTPUT,"fdopen");
         VLOGFP = stderr;
         }
       else


-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



reply via email to

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