objects.cache : CGI fails if line longer than 64K characters (2.0 b3)

Ethan Galstad nagios at nagios.org
Thu May 26 05:25:11 CEST 2005


On 23 May 2005 at 16:47, François 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]='\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: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_idt02&alloc_id135&op=click




More information about the Developers mailing list