diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-01-05 14:09:29 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-01-05 14:09:29 +0000 |
commit | b5d3997aa39169637871a4bca5f860fae21aba3e (patch) | |
tree | 4c6b9e0ac14a45406db2c83a36049e0ea420c4eb /plugins/check_ntp_time.c | |
parent | f83981580eced39b10e096b8eb9a6c4e6434e772 (diff) | |
download | monitoring-plugins-b5d3997aa39169637871a4bca5f860fae21aba3e.tar.gz |
Fix Bug #1862300: check_ntp_time segfault in 1.4.11 (Also apply to check_ntp)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1887 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ntp_time.c')
-rw-r--r-- | plugins/check_ntp_time.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index f414c328..767dcd94 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -274,7 +274,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){ /* if we haven't reached the current list's end, move everyone * over one to the right, and insert the new candidate */ if(i<csize){ - for(j=5; j>i; j--){ + for(j=4; j>i; j--){ candidates[j]=candidates[j-1]; } } @@ -337,6 +337,7 @@ double offset_request(const char *host, int *status){ servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts); if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array"); memset(servers, 0, sizeof(ntp_server_results)*num_hosts); + DBG(printf("Found %d peers to check\n", num_hosts)); /* setup each socket for writing, and the corresponding struct pollfd */ ai_tmp=ai; |