[Nagios-devel] [PATCH] strsep does not handle 1 byte strings

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] [PATCH] strsep does not handle 1 byte strings

Post by Guest »


--Apple-Mail-3-92811623
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed


Hi list,

I've noticed a problem if a subgroup has a member list with trailing
comma.
This means a string with only the separation character will be mis-
parsed by
my_strsep.

It occasionally causes errors on reload like:
Contact '' in contact group '...' is not defined anywhere

Applies to CVS HEAD.


thanks,

William


--Apple-Mail-3-92811623
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0644;
name=strsep_patch.diff
Content-Disposition: attachment;
filename=strsep_patch.diff

--- base/utils.c
+++ base/utils.c
@@ -3050,7 +3050,7 @@ char *my_strsep (char **stringp, const c

ch=delim[0];

- if(ch=='\0')
+ if(ch=='\0' || begin[0]=='\0')
end=NULL;
else{
if(*begin==ch)
@@ -3485,7 +3485,7 @@ char *mmap_fgets_multiline(mmapfile *tem
}

/* one backslash found, so we should continue reading the next line */
- else if(buf[end]=='\\')
+ else if(end>=0 && buf[end]=='\\')
buf[end]='\x0';

/* else no continuation marker was found, so break */

--Apple-Mail-3-92811623
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed




--Apple-Mail-3-92811623--





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked