logo       

nagios/xdata xodtemplate.c,1.105,1.106: msg#00011

Subject: nagios/xdata xodtemplate.c,1.105,1.106
Update of /cvsroot/nagios/nagios/xdata
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12527/xdata

Modified Files:
        xodtemplate.c 
Log Message:
Segfault bugfix in timed events, removed length limitations for object var/val

Index: xodtemplate.c
===================================================================
RCS file: /cvsroot/nagios/nagios/xdata/xodtemplate.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -C2 -d -r1.105 -r1.106
*** xodtemplate.c       7 Jan 2006 19:59:25 -0000       1.105
--- xodtemplate.c       12 Jan 2006 16:13:08 -0000      1.106
***************
*** 4,8 ****
   *
   * Copyright (c) 2001-2006 Ethan Galstad (nagios@xxxxxxxxxx)
!  * Last Modified: 01-07-2006
   *
   * Description:
--- 4,8 ----
   *
   * Copyright (c) 2001-2006 Ethan Galstad (nagios@xxxxxxxxxx)
!  * Last Modified: 01-12-2006
   *
   * Description:
***************
*** 1536,1541 ****
  int xodtemplate_add_object_property(char *input, int options){
        int result=OK;
!       char variable[MAX_XODTEMPLATE_INPUT_BUFFER];
!       char value[MAX_XODTEMPLATE_INPUT_BUFFER];
        char *temp_ptr;
        xodtemplate_timeperiod *temp_timeperiod;
--- 1536,1541 ----
  int xodtemplate_add_object_property(char *input, int options){
        int result=OK;
!       char *variable=NULL;
!       char *value=NULL;
        char *temp_ptr;
        xodtemplate_timeperiod *temp_timeperiod;
***************
*** 1555,1558 ****
--- 1555,1559 ----
        register int x;
        register int y;
+       register int len;
  #ifdef NSCORE
        char temp_buffer[MAX_XODTEMPLATE_INPUT_BUFFER];
***************
*** 1627,1648 ****
                }
  
! 
! #ifdef REMOVED_05252005
!       /* truncate if necessary */
!       if(strlen(input)>MAX_XODTEMPLATE_INPUT_BUFFER)
!               input[MAX_XODTEMPLATE_INPUT_BUFFER-1]='\x0';
! #endif
  
        /* get variable name */
        for(x=0,y=0;input[x]!='\x0';x++){
                if(input[x]==' ' || input[x]=='\t')
                        break;
!               else
!                       variable[y++]=input[x];
                }
        variable[y]='\x0';
                        
        /* get variable value */
!       if(x>=strlen(input)){
  #ifdef DEBUG1
                printf("Error: NULL variable value in object definition.\n");
--- 1628,1656 ----
                }
  
!       /* allocate memory */
!       len=strlen(input);
!       if((variable=(char *)malloc(len+1))==NULL)
!               return ERROR;
!       if((value=(char *)malloc(len+1))==NULL){
!               free(variable);
!               return ERROR;
!               }
  
        /* get variable name */
+       strcpy(variable,input);
        for(x=0,y=0;input[x]!='\x0';x++){
                if(input[x]==' ' || input[x]=='\t')
                        break;
!               y++;
                }
        variable[y]='\x0';
                        
        /* get variable value */
!       /* skip leading whitespace */
!       for(;input[x]!='\x0';x++){
!               if(input[x]!=' ' && input[x]!='\t')
!                       break;
!               }
!       if(x>=len){
  #ifdef DEBUG1
                printf("Error: NULL variable value in object definition.\n");
***************
*** 1650,1656 ****
                return ERROR;
                }
!       for(y=0;input[x]!='\x0';x++)
!               value[y++]=input[x];
!       value[y]='\x0';
  
        /*
--- 1658,1662 ----
                return ERROR;
                }
!       strcpy(value,input+x);
  
        /*
***************
*** 3691,3694 ****
--- 3697,3704 ----
                }
  
+       /* free memory */
+       free(variable);
+       free(value);
+ 
  #ifdef DEBUG0
        printf("xodtemplate_add_object_property() end\n");



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe