RE : [Nagios-devel] objects.cache : CGI fails if line longer than 64K characters (2.0 b3)
Posted: Wed May 25, 2005 7:24 pm
On 23 May 2005 at 16:47, Fran=C3=A7ois Laupretre wrote:
>
> Andreas Ericsson wrote :
> > That would be mmap_fgets. I've got a feeling you're about to
> discover
> > that 65536 is the magic roof of the length of member-lists in
> > service-descriptions. Perhaps there is an unsigned short somewhere
> in
> > there which causes this weird limit.
> Got it. Actually, it is not mmap_fgets. Mmap_fgets returns a buffer of
> 80 K chars without problems. But, in xodtemplate_add_object_property,
> there is a f... line that says :
> /* truncate if necessary */
> if(strlen(input)>MAX_XODTEMPLATE_INPUT_BUFFER)
> input[MAX_XODTEMPLATE_INPUT_BUFFER-1]=3D'\x0';
> And MAX_XODTEMPLATE_INPUT_BUFFER is defined as 65535 !
> After defining it to 16*65535, everything works well...
> This limit is right when we read from a primary config file and it was
> certainly put here when the cache file did not exist yet, but
> something should be done not to enforce it when we read from the
> objects cache file, because it contains some aggregation of host &
> service group members, and these lines can easily be longer than the
> limit of 64 K. There is still a mistery : it is the fact that, after
> being truncated, the resulting string (used for registration) is not
> null- terminated, as the code above would suggest. I have already lost
> one day and I won't spend more on the subject but it can be
> interesting to investigate.
I'm just going to remove that string termination statement - it was
from older code present before mmap_fgets() and I don't think it is
required for anything anymore. Fix will be in CVS soon, so give it a
try and let me know what happens.
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
>
> Andreas Ericsson wrote :
> > That would be mmap_fgets. I've got a feeling you're about to
> discover
> > that 65536 is the magic roof of the length of member-lists in
> > service-descriptions. Perhaps there is an unsigned short somewhere
> in
> > there which causes this weird limit.
> Got it. Actually, it is not mmap_fgets. Mmap_fgets returns a buffer of
> 80 K chars without problems. But, in xodtemplate_add_object_property,
> there is a f... line that says :
> /* truncate if necessary */
> if(strlen(input)>MAX_XODTEMPLATE_INPUT_BUFFER)
> input[MAX_XODTEMPLATE_INPUT_BUFFER-1]=3D'\x0';
> And MAX_XODTEMPLATE_INPUT_BUFFER is defined as 65535 !
> After defining it to 16*65535, everything works well...
> This limit is right when we read from a primary config file and it was
> certainly put here when the cache file did not exist yet, but
> something should be done not to enforce it when we read from the
> objects cache file, because it contains some aggregation of host &
> service group members, and these lines can easily be longer than the
> limit of 64 K. There is still a mistery : it is the fact that, after
> being truncated, the resulting string (used for registration) is not
> null- terminated, as the code above would suggest. I have already lost
> one day and I won't spend more on the subject but it can be
> interesting to investigate.
I'm just going to remove that string termination statement - it was
from older code present before mmap_fgets() and I don't think it is
required for anything anymore. Fix will be in CVS soon, so give it a
try and let me know what happens.
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]