[monitoring-plugins] Initialize slaveresult to 0 and use strncat ...

RincewindsHat git at monitoring-plugins.org
Mon Sep 18 23:20:11 CEST 2023


 Module: monitoring-plugins
 Branch: master
 Commit: ce355c80cf6054bfa5e1dcf81f9e2183ef963ee1
 Author: RincewindsHat <12514511+RincewindsHat at users.noreply.github.com>
   Date: Mon Sep 18 22:58:34 2023 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=ce355c8

Initialize slaveresult to 0 and use strncat instead of bsd strlcat

---

 plugins/check_mysql.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 8dc554f..9b7d13f 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -110,7 +110,7 @@ main (int argc, char **argv)
 
 	char *result = NULL;
 	char *error = NULL;
-	char slaveresult[SLAVERESULTSIZE];
+	char slaveresult[SLAVERESULTSIZE] = { 0 };
 	char* perf;
 
         perf = strdup ("");
@@ -299,7 +299,7 @@ main (int argc, char **argv)
 				if (mysqldump_threads == 0) {
 					die (STATE_CRITICAL, "%s\n", slaveresult);
 				} else {
-					strlcat (slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE);
+					strncat(slaveresult, " Mysqldump: in progress", SLAVERESULTSIZE-1);
 				}
 			}
 



More information about the Commits mailing list