check_mrtg* segfaults

Jochen Bern Jochen.Bern at LINworks.de
Fri Nov 25 21:56:37 CET 2011


[Sorry to post this to nagios-devel instead of a nagios-plugins
mailinglist, but I'm not subscribed there and I seem to be unable to
find the list of mailinglists offhand. The link "Community mailing
lists" on http://www.nagios.org/support , pointing to
http://wiki.nagios.org/index.php/Mail_Lists , seems to get
404ed-slash-redirected to the wiki's main page and using the wiki's
search function turns up nada.]

I tried to help someone whose check_mrtgtraf kept segfaulting during the
last couple days, the problem turning out to be that he had pointed it
to the wrong file. It seems that check_mrtg and check_mrtgtraf (up to
and including 1.4.15) aren't prepared to deal with syntax problems in
their input file.

The (quickest possible) fix is pretty trivial: Expand every

		temp_buffer = strtok (input_buffer, " ");
		[whatever] = strtoul (temp_buffer, NULL, 10);

into

		temp_buffer = strtok (input_buffer, " ");
		if (temp_buffer == NULL) {
			printf (_("Cannot parse MRTG log file\n"));
			return STATE_UNKNOWN;
		}
		[whatever] = strtoul (temp_buffer, NULL, 10);

Kind regards,
								J. Bern
-- 
Jochen Bern, Systemingenieur --- LINworks GmbH <http://www.LINworks.de/>
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d




More information about the Developers mailing list