diff options
Diffstat (limited to 'plugins/check_ntp_time.c')
| -rw-r--r-- | plugins/check_ntp_time.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 3e23d0bf..2d9a6f40 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include "thresholds.h" | 43 | #include "thresholds.h" |
| 44 | #include "check_ntp_time.d/config.h" | 44 | #include "check_ntp_time.d/config.h" |
| 45 | #include <netinet/in.h> | 45 | #include <netinet/in.h> |
| 46 | #include <string.h> | ||
| 46 | #include <sys/socket.h> | 47 | #include <sys/socket.h> |
| 47 | 48 | ||
| 48 | static int verbose = 0; | 49 | static int verbose = 0; |
| @@ -395,7 +396,10 @@ static offset_request_wrapper offset_request(const char *host, const char *port, | |||
| 395 | .sun_family = AF_UNIX, | 396 | .sun_family = AF_UNIX, |
| 396 | }; | 397 | }; |
| 397 | 398 | ||
| 398 | strncpy(unix_socket.sun_path, host, strlen(host)); | 399 | if (strlen(host) > sizeof(unix_socket.sun_path)) { |
| 400 | die(STATE_UNKNOWN, "host argument is too long (%lu) for a socket path\n", strlen(host)); | ||
| 401 | } | ||
| 402 | strncpy(unix_socket.sun_path, host, sizeof(unix_socket.sun_path)); | ||
| 399 | 403 | ||
| 400 | if (connect(socklist[0], &unix_socket, sizeof(unix_socket))) { | 404 | if (connect(socklist[0], &unix_socket, sizeof(unix_socket))) { |
| 401 | /* don't die here, because it is enough if there is one server | 405 | /* don't die here, because it is enough if there is one server |
