[PATCH] SIGSEGV in checks.c on Solaris

thuebler at sachsendv.de thuebler at sachsendv.de
Tue Mar 16 11:54:06 CET 2010


printf functions on Solaris crash with SIGSEGV when getting a NULL pointer 
as an argument (happend here after installing some check_mk checks).
On Linux/glibc, the string "(null)" is returned.

This patch copies the fixed code from line 821 to all other occurences of 
"fprintf( ... checkresult_dbuf.buf);".

Torsten
==============================


diff -aur nagios-3.2.1/base/checks.c nagios-3.2.1-thu/base/checks.c
--- nagios-3.2.1/base/checks.c  2009-08-11 18:56:39.000000000 +0200
+++ nagios-3.2.1-thu/base/checks.c      2010-03-16 10:37:16.267166958 
+0100
@@ -607,7 +607,7 @@
 
fprintf(check_result_info.output_file_fp,"early_timeout=%d\n",check_result_info.early_timeout);
 
fprintf(check_result_info.output_file_fp,"exited_ok=%d\n",check_result_info.exited_ok);
 
fprintf(check_result_info.output_file_fp,"return_code=%d\n",check_result_info.return_code);
- 
fprintf(check_result_info.output_file_fp,"output=%s\n",checkresult_dbuf.buf);
+ 
fprintf(check_result_info.output_file_fp,"output=%s\n",(checkresult_dbuf.buf==NULL)?"(null)":checkresult_dbuf.buf);

                                /* close the temp file */
                                fclose(check_result_info.output_file_fp);
@@ -748,7 +748,7 @@
 
fprintf(check_result_info.output_file_fp,"early_timeout=%d\n",check_result_info.early_timeout);
 
fprintf(check_result_info.output_file_fp,"exited_ok=%d\n",check_result_info.exited_ok);
 
fprintf(check_result_info.output_file_fp,"return_code=%d\n",check_result_info.return_code);
- 
fprintf(check_result_info.output_file_fp,"output=%s\n",checkresult_dbuf.buf);
+ 
fprintf(check_result_info.output_file_fp,"output=%s\n",(checkresult_dbuf.buf==NULL)?"(null)":checkresult_dbuf.buf);

                                        /* close the temp file */
 fclose(check_result_info.output_file_fp);
@@ -3131,7 +3131,7 @@
 
fprintf(check_result_info.output_file_fp,"early_timeout=%d\n",check_result_info.early_timeout);
 
fprintf(check_result_info.output_file_fp,"exited_ok=%d\n",check_result_info.exited_ok);
 
fprintf(check_result_info.output_file_fp,"return_code=%d\n",check_result_info.return_code);
- 
fprintf(check_result_info.output_file_fp,"output=%s\n",checkresult_dbuf.buf);
+ 
fprintf(check_result_info.output_file_fp,"output=%s\n",(checkresult_dbuf.buf==NULL)?"(null)":checkresult_dbuf.buf);

                                /* close the temp file */
                                fclose(check_result_info.output_file_fp);


_________________________________________________________________

Sachsen DV Betriebs- und Servicegesellschaft mbH
Täubchenweg 26
04317 Leipzig
Amtsgericht Leipzig, HRB 18545

Geschäftsführer: Herbert Roller Brandão, Dr. Jean-Michael Pfitzner

Aufsichtsratsvorsitzender: Sven Petersen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20100316/9f824ef1/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list