[monitoring-plugins] check_ntp: fix null termination

Holger Weiss git at monitoring-plugins.org
Thu Nov 27 01:00:08 CET 2014


    Module: monitoring-plugins
    Branch: maint
    Commit: a4a1b37be0ff96492d13e87ce59c82482d961f56
    Author: Sebastian Herbszt <herbszt at gmx.de>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Wed Nov 26 23:54:49 2014 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a4a1b37

check_ntp: fix null termination

Fix null termination introduced by commit a04df3e ("plugins/check_ntp.c - Verify struct from response").

Signed-off-by: Sebastian Herbszt <herbszt at gmx.de>

---

 plugins/check_ntp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 09a923e..546802a 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -616,7 +616,7 @@ double jitter_request(const char *host, int *status){
 				if (bytes_read != ntp_cm_ints + req.count)
 					die(STATE_UNKNOWN, _("Invalid NTP response: %d bytes read does not equal %d plus %d data segment"), bytes_read, ntp_cm_ints, req.count); 
 				/* else null terminate */
-				strncpy(req.data[req.count], "\0", 1);
+				req.data[req.count] = '\0';
 
 				DBG(print_ntp_control_message(&req));
 



More information about the Commits mailing list