bug-cfengine
[Top][All Lists]
Advanced

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

Patch2: editfiles:SetCommentStart/SetCommentEnd ...


From: Eric Berggren
Subject: Patch2: editfiles:SetCommentStart/SetCommentEnd ...
Date: Tue, 23 Jan 2001 18:38:33 -0800

  Okay, might as well be buffer-overflow conscience; here's an updated
patch (disregard last one) which simply trades strncpy() for strcpy() :

-eric

*** orig/cf.extern.h    Tue Jan 23 14:38:42 2001
--- cf.extern.h Tue Jan 23 17:49:37 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 */
  
*** orig/edittools.c    Tue Jan 23 14:38:42 2001
--- edittools.c Tue Jan 23 17:52:42 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,580 ----
                 break;
  
        case SetCommentStart:
!                strncpy(COMMENTSTART,expdata,maxvarsize);
!                COMMENTSTART[maxvarsize-1] = '\0';
                 break;
  
        case SetCommentEnd:
!                strncpy(COMMENTEND,expdata,maxvarsize);
!                COMMENTEND[maxvarsize-1] = '\0';
                 break;
  
        case CommentLinesMatching:
*** orig/globals.c      Tue Jan 23 14:38:42 2001
--- globals.c   Tue Jan 23 17:49:37 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]