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
|