bug-cfengine
[Top][All Lists]
Advanced

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

Patch: editfiles:SetCommentStart/SetCommentEnd ...


From: Eric Berggren
Subject: Patch: editfiles:SetCommentStart/SetCommentEnd ...
Date: Tue, 23 Jan 2001 14:56:24 -0800

  Addresses "editfiles:UnCommentLinesContaining" issue, which was
actually due to pointer overruns that I and someone else reported
earlier; use arrays, not pointers for string variables that may later
change.  There may be other instances in this sort, but haven't picked
through the code yet...


share and enjoy,  :D
-eric


*** cf.extern.h.orig    Sun Dec 10 10:16:37 2000
--- cf.extern.h Tue Jan 23 14:04:15 2001
***************
*** 373,379 ****
  extern int SEARCHREPLACELEVEL;
  extern int FOREACHLEVEL;
  
! extern char *COMMENTSTART, *COMMENTEND;
  
  /* GNU REGEXP */
  
--- 373,379 ----
  extern int SEARCHREPLACELEVEL;
  extern int FOREACHLEVEL;
  
! extern char COMMENTSTART[], COMMENTEND[];
  
  /* GNU REGEXP */
  
*** edittools.c.orig    Mon Jan  1 09:38:32 2001
--- edittools.c Tue Jan 23 14:00:54 2001
***************
*** 392,399 ****
  EDITVERBOSE = VERBOSE;
  CURRENTLINENUMBER = 1;
  CURRENTLINEPTR = filestart;
! COMMENTSTART = "# ";
! COMMENTEND = "";
  EDITGROUPLEVEL = 0;
  SEARCHREPLACELEVEL = 0;
  FOREACHLEVEL = 0;
--- 392,399 ----
  EDITVERBOSE = VERBOSE;
  CURRENTLINENUMBER = 1;
  CURRENTLINEPTR = filestart;
! strcpy(COMMENTSTART,"# ");
! strcpy(COMMENTEND,"");
  EDITGROUPLEVEL = 0;
  SEARCHREPLACELEVEL = 0;
  FOREACHLEVEL = 0;
***************
*** 568,578 ****
                 break;
  
        case SetCommentStart:
!                COMMENTSTART = expdata;
                 break;
  
        case SetCommentEnd:
!                COMMENTEND = expdata;
                 break;
  
        case CommentLinesMatching:
--- 568,578 ----
                 break;
  
        case SetCommentStart:
!                strcpy(COMMENTSTART, expdata);
                 break;
  
        case SetCommentEnd:
!                strcpy(COMMENTEND, expdata);
                 break;
  
        case CommentLinesMatching:
*** globals.c.orig      Sun Dec 10 10:16:14 2000
--- globals.c   Tue Jan 23 13:56:33 2001
***************
*** 695,702 ****
  
    PRIVATE int AUTOCREATED = 0;
  
!   PRIVATE char *COMMENTSTART;
!   PRIVATE char *COMMENTEND;
  
    PUBLIC char *VEDITNAMES[] =
       {
--- 695,702 ----
  
    PRIVATE int AUTOCREATED = 0;
  
!   PRIVATE char COMMENTSTART[ maxvarsize ];
!   PRIVATE char COMMENTEND[ maxvarsize ];
  
    PUBLIC char *VEDITNAMES[] =
       {



reply via email to

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