[monitoring-plugins] Avoid passing NULL to vprintf().

Guido Falsi git at monitoring-plugins.org
Mon Oct 22 16:30:18 CEST 2018


 Module: monitoring-plugins
 Branch: master
 Commit: c76f59bcc0b4c1a14caa7028e034ab44d3e1b4a8
 Author: Guido Falsi <mad at madpilot.net>
   Date: Sat Sep 29 16:15:42 2018 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=c76f59b

Avoid passing NULL to vprintf().

---

 lib/utils_base.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/utils_base.c b/lib/utils_base.c
index 3822bcf..19a531f 100644
--- a/lib/utils_base.c
+++ b/lib/utils_base.c
@@ -87,10 +87,13 @@ void _get_monitoring_plugin( monitoring_plugin **pointer ){
 void
 die (int result, const char *fmt, ...)
 {
-	va_list ap;
-	va_start (ap, fmt);
-	vprintf (fmt, ap);
-	va_end (ap);
+	if(fmt!=NULL) {
+		va_list ap;
+		va_start (ap, fmt);
+		vprintf (fmt, ap);
+		va_end (ap);
+	}
+
 	if(this_monitoring_plugin!=NULL) {
 		np_cleanup();
 	}



More information about the Commits mailing list