bug-cfengine
[Top][All Lists]
Advanced

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

DeleteNLines segfault in 2.0.1


From: Matt Armstrong
Subject: DeleteNLines segfault in 2.0.1
Date: Thu, 18 Apr 2002 14:59:55 -0600
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i386-debian-linux-gnu)

I have this:

    any::
    {
        /etc/postfix/header_checks.pcre

        LocateLineMatching "^# cfengine begin.*"
        BeginGroupIfNoMatch "^# cfengine begin - 2002-04-18.2"
            DeleteToLineMatching "^# cfengine end.*"
            DeleteNLines "1"
        EndGroup

        BeginGroupIfNoSuchLine "# cfengine begin - 2002-04-18.2"
                Append "# cfengine begin - 2002-04-18.2"
                Append "/^Errors-To:/ IGNORE"
                Append "/^(subject|from)\s*:.*[^0-127]{5,}/ REJECT The message 
headers contain non ASCII characters."
                Append "# cfengine end - 2002-04-18.2"
        EndGroup
        DefineClasses "reload_postfix"
    }

it will cause cfagent to segfault if the "# cfengine begin" is the
first line of the file.  Patch below:

--- src/item-ext.c.orig Thu Apr 18 10:59:31 2002
+++ src/item-ext.c      Thu Apr 18 14:50:08 2002
@@ -1219,7 +1219,7 @@
    return true;
    }
 
-for (ip_prev = *filestart; ip_prev->next != CURRENTLINEPTR; 
ip_prev=ip_prev->next)
+for (ip_prev = *filestart; ip_prev && ip_prev->next != CURRENTLINEPTR; 
ip_prev=ip_prev->next)
    {
    }
 
@@ -1248,7 +1248,7 @@
    NUMBEROFEDITS++;
    CURRENTLINEPTR = ip->next;
 
-   if (ip == *filestart)
+   if (ip_prev == NULL)
       {
       *filestart = ip->next;
       }


-- 
matt



reply via email to

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