pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/nagios-plugins Location header buffer overflow fix...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/98d555432114
branches:  trunk
changeset: 540025:98d555432114
user:      tonnerre <tonnerre%pkgsrc.org@localhost>
date:      Sat Mar 22 14:52:21 2008 +0000

description:
Location header buffer overflow fix for nagios-plugins-1.4.3
check_http (CVE-2007-5198)
Approved-by: gdt

diffstat:

 net/nagios-plugins/Makefile         |    6 +-
 net/nagios-plugins/distinfo         |    3 +-
 net/nagios-plugins/patches/patch-aa |  100 ++++++++++++++++++++++++++++++++++++
 3 files changed, 105 insertions(+), 4 deletions(-)

diffs (135 lines):

diff -r f5d7f8c208a6 -r 98d555432114 net/nagios-plugins/Makefile
--- a/net/nagios-plugins/Makefile       Sat Mar 22 09:01:54 2008 +0000
+++ b/net/nagios-plugins/Makefile       Sat Mar 22 14:52:21 2008 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.12 2008/01/18 05:08:45 tnn Exp $
+# $NetBSD: Makefile,v 1.13 2008/03/22 14:52:21 tonnerre Exp $
 #
 
-PKGREVISION=   4
+PKGREVISION=   5
 CATEGORIES=    net sysutils
 
-MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+MAINTAINER=    tonnerre%NetBSD.org@localhost
 HOMEPAGE=      http://sourceforge.net/projects/nagiosplug/
 COMMENT=       Nagios plugins
 
diff -r f5d7f8c208a6 -r 98d555432114 net/nagios-plugins/distinfo
--- a/net/nagios-plugins/distinfo       Sat Mar 22 09:01:54 2008 +0000
+++ b/net/nagios-plugins/distinfo       Sat Mar 22 14:52:21 2008 +0000
@@ -1,8 +1,9 @@
-$NetBSD: distinfo,v 1.4 2007/03/30 05:52:37 grant Exp $
+$NetBSD: distinfo,v 1.5 2008/03/22 14:52:21 tonnerre Exp $
 
 SHA1 (nagios-plugins-1.4.3.tar.gz) = c26fc2f31d7579c3a8174dcd1965046c4b1c8d37
 RMD160 (nagios-plugins-1.4.3.tar.gz) = bc1d4f8cddd481775c514758a462fe533e01e846
 Size (nagios-plugins-1.4.3.tar.gz) = 1257775 bytes
+SHA1 (patch-aa) = b0db6110edb7e75121bbee7c996e36454e820a41
 SHA1 (patch-ab) = 1bcd6ddd5ef77c4ab726de4d6ac0a50fd525fa47
 SHA1 (patch-ad) = 2b88b23b790b454cb1f5e2dc1b6735a43534834c
 SHA1 (patch-ae) = c22cbbaece4c9145356f96abd9d72192c226b19f
diff -r f5d7f8c208a6 -r 98d555432114 net/nagios-plugins/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/nagios-plugins/patches/patch-aa       Sat Mar 22 14:52:21 2008 +0000
@@ -0,0 +1,100 @@
+$NetBSD: patch-aa,v 1.1 2008/03/22 14:52:21 tonnerre Exp $
+
+--- plugins/check_http.c.orig  2006-04-05 09:58:27.000000000 +0200
++++ plugins/check_http.c
+@@ -34,7 +34,8 @@ const char *email = "nagiosplug-devel@li
+ enum {
+   MAX_IPV4_HOSTLENGTH = 255,
+   HTTP_PORT = 80,
+-  HTTPS_PORT = 443
++  HTTPS_PORT = 443,
++  MAX_PORT = 65535
+ };
+ 
+ #ifdef HAVE_SSL
+@@ -1043,14 +1044,14 @@ check_http (void)
+ 
+ /* per RFC 2396 */
+ #define HDR_LOCATION "%*[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]: "
+-#define URI_HTTP "%[HTPShtps]://"
+-#define URI_HOST "%[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"
+-#define URI_PORT ":%[0123456789]"
++#define URI_HTTP "%5[HTPShtps]"
++#define URI_HOST "%255[-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"
++#define URI_PORT "%6d" /* MAX_PORT's width is 5 chars, 6 to detect overflow */
+ #define URI_PATH "%[-_.!~*'();/?:@&=+$,%#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]"
+-#define HD1 URI_HTTP URI_HOST URI_PORT URI_PATH
+-#define HD2 URI_HTTP URI_HOST URI_PATH
+-#define HD3 URI_HTTP URI_HOST URI_PORT
+-#define HD4 URI_HTTP URI_HOST
++#define HD1 URI_HTTP "://" URI_HOST ":" URI_PORT "/" URI_PATH
++#define HD2 URI_HTTP "://" URI_HOST "/" URI_PATH
++#define HD3 URI_HTTP "://" URI_HOST ":" URI_PORT
++#define HD4 URI_HTTP "://" URI_HOST
+ #define HD5 URI_PATH
+ 
+ void
+@@ -1061,7 +1062,6 @@ redir (char *pos, char *status_line)
+   char xx[2];
+   char type[6];
+   char *addr;
+-  char port[6];
+   char *url;
+ 
+   addr = malloc (MAX_IPV4_HOSTLENGTH + 1);
+@@ -1093,10 +1093,8 @@ redir (char *pos, char *status_line)
+       die (STATE_UNKNOWN, _("could not allocate url\n"));
+ 
+     /* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */
+-    if (sscanf (pos, HD1, type, addr, port, url) == 4) {
++    if (sscanf (pos, HD1, type, addr, &i, url) == 4)
+       use_ssl = server_type_check (type);
+-      i = atoi (port);
+-    }
+ 
+     /* URI_HTTP URI_HOST URI_PATH */
+     else if (sscanf (pos, HD2, type, addr, url) == 3 ) { 
+@@ -1105,10 +1103,9 @@ redir (char *pos, char *status_line)
+     }
+ 
+     /* URI_HTTP URI_HOST URI_PORT */
+-    else if(sscanf (pos, HD3, type, addr, port) == 3) {
++    else if(sscanf (pos, HD3, type, addr, &i) == 3) {
+       strcpy (url, HTTP_URL);
+       use_ssl = server_type_check (type);
+-      i = atoi (port);
+     }
+ 
+     /* URI_HTTP URI_HOST */
+@@ -1154,7 +1151,6 @@ redir (char *pos, char *status_line)
+          _("WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
+          type, addr, i, url, (display_html ? "</A>" : ""));
+ 
+-  server_port = i;
+   strcpy (server_type, type);
+ 
+   free (host_name);
+@@ -1164,7 +1160,22 @@ redir (char *pos, char *status_line)
+   server_address = strdup (addr);
+ 
+   free (server_url);
+-  server_url = strdup (url);
++  if ((url[0] == '/'))
++    server_url = strdup (url);
++  else if (asprintf(&server_url, "/%s", url) == -1)
++    die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate server_url%s\n"),
++         display_html ? "</A>" : "");
++  free(url);
++
++  if ((server_port = i) > MAX_PORT)
++    die (STATE_UNKNOWN,
++         _("HTTP UNKNOWN - Redirection to port above %d - %s://%s:%d%s%s\n"),
++         MAX_PORT, server_type, server_address, server_port, server_url,
++         display_html ? "</A>" : "");
++
++  if (verbose)
++    printf ("Redirection to %s://%s:%d%s\n", server_type, server_address,
++            server_port, server_url);
+ 
+   check_http ();
+ }



Home | Main Index | Thread Index | Old Index