Nagios Bug and Feature Tracker
Bug and Feature Tracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000358 [Nagios Core] Other / Unknown major sometimes 2012-07-22 19:05 2012-09-05 06:56
Reporter roguelazer View Status public  
Assigned To ageric
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0000358: with empty hostgroups, $HOSTGROUPMEMBERS$ returns garbage
Description It looks like there's a missing NUL byte in the output string from the $HOSTGROUPMEMBERS$ macro when it's called on an empty hostgroup. Needless to say, our service checks really don't take kindly to being fed garbage and end up spitting out yet more garbage.

This is extra-fun, because sometimes malloc will return memory that has a 0 as the first byte, in which case everything will seem to work fine.
Additional Information Examples from my debug log when I make the "web" hostgroup empty:

--
[1342996658.035584] [2048.1] [pid=16248] Processing: '$HOSTGROUPMEMBERS:web$'
[1342996658.035594] [2048.1] [pid=16248] Done. Final output: '<A8><BE>\<9D>m^?'
--
[1342996658.036251] [2048.1] [pid=16248] Processing: '$HOSTGROUPMEMBERS:web$'
[1342996658.036258] [2048.1] [pid=16248] Done. Final output: ''


I've attached a really dumb patch for this. I suspect that the other macros may need to be audited for the same behavior, but that's not a sunday afternoon project.
Tags No tags attached.
Nagios Version 3.4.1
OS Ubuntu Linux
OS Version 10.04
Attached Files ? file icon macro_safety.diff [^] (1,215 bytes) 2012-07-22 19:05

- Relationships

-  Notes
(0000557)
ageric (administrator)
2012-09-05 06:56

commit 3eea40cc2f12868fb8355a10712643844d3a6a29
Author: Andreas Ericsson <ae@op5.se>
Date: Wed Sep 5 10:55:41 2012 +0000

    common/macros: Return a nul string for empty host and servicegroups
    
    Contactgroups seem to be handled differently, so perhaps they don't
    matter.
    
    This fixes issue 358, although not in the way the reporter suggested.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    
    git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2151 [^] 5f96b256-904b-4d8d-8c98-d829582c6739

- Issue History
Date Modified Username Field Change
2012-07-22 19:05 roguelazer New Issue
2012-07-22 19:05 roguelazer File Added: macro_safety.diff
2012-07-22 19:05 roguelazer Nagios Version => 3.4.1
2012-07-22 19:05 roguelazer OS => Ubuntu Linux
2012-07-22 19:05 roguelazer OS Version => 10.04
2012-09-05 06:55 ageric Status new => assigned
2012-09-05 06:55 ageric Assigned To => ageric
2012-09-05 06:56 ageric Note Added: 0000557
2012-09-05 06:56 ageric Status assigned => closed
2012-09-05 06:56 ageric Resolution open => fixed


Mantis 1.1.7[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker