[PATCH] check_ntp: fix null termination
Sebastian Herbszt
herbszt at gmx.de
Wed Nov 26 23:54:49 CET 2014
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 fb4450c..7488fa5 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));
--
2.1.0
More information about the Devel
mailing list