fix buffer overflow

This commit is contained in:
Jan Wagner 2009-05-14 19:54:24 +00:00
parent b880fb744a
commit 591967c72c
3 changed files with 35 additions and 0 deletions

2
debian/changelog vendored
View file

@ -3,6 +3,8 @@ nagios-plugins (1.4.12-6) UNRELEASED; urgency=low
* add trailing $ to check_httpname, thanks Daniel Pocock (Closes: #524629)
* add informations into README.Debian how to use plugins (Closes: #525168)
* add check_nscp which uses the default port of NSClient++ (Closes: #528262)
* add 43_check_ntp_segfaults.dpatch to fix buffer overflow in check_ntp and
check_ntp_peer, thanks to Andreas Olsson (Closes: #528686)
-- Jan Wagner <waja@cyconet.org> Sun, 01 Feb 2009 03:19:57 +0100

View file

@ -17,4 +17,5 @@
40_check_http_status_line.dpatch
41_check_http_fix_http_header.dpatch
42_check_ups_logoutfix.dpatch
43_check_ntp_segfaults.dpatch
50_misc_typos.dpatch

View file

@ -0,0 +1,32 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 43_check_ntp_segfaults.dpatch by Thierry Carrez <thierry.carrez@ubuntu.com>
##
## DP: Fixes check_ntp and check_ntp_peer segfaults (LP: #291265)
## Patch originally from Thomas Guyot, extracted from upstream SVN at:
## http://nagiosplug.svn.sourceforge.net/viewvc/nagiosplug?view=rev&revision=2086
@DPATCH@
diff -urNad nagios-plugins-1.4.12~/plugins/check_ntp.c nagios-plugins-1.4.12/plugins/check_ntp.c
--- nagios-plugins-1.4.12~/plugins/check_ntp.c 2008-05-07 10:02:42.000000000 +0000
+++ nagios-plugins-1.4.12/plugins/check_ntp.c 2008-11-19 16:38:06.000000000 +0000
@@ -198,7 +198,7 @@
/* NTP control message header is 12 bytes, plus any data in the data
* field, plus null padding to the nearest 32-bit boundary per rfc.
*/
-#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((m.count)?4-(ntohs(m.count)%4):0))
+#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((ntohs(m.count)%4)?4-(ntohs(m.count)%4):0))
/* finally, a little helper or two for debugging: */
#define DBG(x) do{if(verbose>1){ x; }}while(0);
diff -urNad nagios-plugins-1.4.12~/plugins/check_ntp_peer.c nagios-plugins-1.4.12/plugins/check_ntp_peer.c
--- nagios-plugins-1.4.12~/plugins/check_ntp_peer.c 2008-05-07 10:02:42.000000000 +0000
+++ nagios-plugins-1.4.12/plugins/check_ntp_peer.c 2008-11-19 16:38:06.000000000 +0000
@@ -130,7 +130,7 @@
/* NTP control message header is 12 bytes, plus any data in the data
* field, plus null padding to the nearest 32-bit boundary per rfc.
*/
-#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((m.count)?4-(ntohs(m.count)%4):0))
+#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((ntohs(m.count)%4)?4-(ntohs(m.count)%4):0))
/* finally, a little helper or two for debugging: */
#define DBG(x) do{if(verbose>1){ x; }}while(0);