summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_peer.c
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-09-02 03:42:16 (GMT)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-09-02 03:42:16 (GMT)
commita24c8f001fade8b136cb03781951d474b5e4456d (patch)
tree78be19ea3784e20ad2c0a64823618fd3946da558 /plugins/check_ntp_peer.c
parent122610e3730b8dd4afb41dfa48e65ba75f5586fe (diff)
downloadmonitoring-plugins-a24c8f001fade8b136cb03781951d474b5e4456d.tar.gz
Fix possible segfault in check_ntp_peer with deliberately invalid packets
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2052 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ntp_peer.c')
-rw-r--r--plugins/check_ntp_peer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index 72cec63..6a4401c 100644
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -299,6 +299,9 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
299 if(read(conn, &req, SIZEOF_NTPCM(req)) == -1) 299 if(read(conn, &req, SIZEOF_NTPCM(req)) == -1)
300 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n"); 300 die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
301 DBG(print_ntp_control_message(&req)); 301 DBG(print_ntp_control_message(&req));
302 /* discard obviously invalid packets */
303 if (ntohs(req.count) > MAX_CM_SIZE)
304 die(STATE_CRITICAL, "NTP CRITICAL: Invalid paclet received from NTP server\n");
302 if (LI(req.flags) == LI_ALARM) li_alarm = 1; 305 if (LI(req.flags) == LI_ALARM) li_alarm = 1;
303 /* Each peer identifier is 4 bytes in the data section, which 306 /* Each peer identifier is 4 bytes in the data section, which
304 * we represent as a ntp_assoc_status_pair datatype. 307 * we represent as a ntp_assoc_status_pair datatype.