[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kernel/3646: pf doesn't properly parse IPv4 addresses any more
- To: bugs_(_at_)_cvs_(_dot_)_openbsd_(_dot_)_org
- Subject: Re: kernel/3646: pf doesn't properly parse IPv4 addresses any more
- From: Henning Brauer <lists-openbsdbugs_(_at_)_bsws_(_dot_)_de>
- Date: Sun, 25 Jan 2004 14:05:02 -0700 (MST)
- Cc:
- Reply-to: Henning Brauer <lists-openbsdbugs_(_at_)_bsws_(_dot_)_de>
The following reply was made to PR kernel/3646; it has been noted by GNATS.
From: Henning Brauer <lists-openbsdbugs_(_at_)_bsws_(_dot_)_de>
To: Frank Denis <j_(_at_)_pureftpd_(_dot_)_org>
Cc: gnats_(_at_)_openbsd_(_dot_)_org
Subject: Re: kernel/3646: pf doesn't properly parse IPv4 addresses any more
Date: Sun, 25 Jan 2004 21:49:09 +0100
aaaaaaaaaarrrrrrrrrrgggggggggggghhhhhhhhhh
try this diff please
Index: pfctl_parser.c
===================================================================
RCS file: /cvs/src/sbin/pfctl/pfctl_parser.c,v
retrieving revision 1.189
diff -u -r1.189 pfctl_parser.c
--- pfctl_parser.c 25 Jan 2004 18:47:15 -0000 1.189
+++ pfctl_parser.c 25 Jan 2004 20:49:15 -0000
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.189 2004/01/25 18:47:15 deraadt Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.188 2004/01/22 13:32:00 henning Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1326,20 +1326,26 @@
{
struct node_host *h = NULL;
struct in_addr ina;
- int bits;
+ int bits = 32;
memset(&ina, 0, sizeof(struct in_addr));
- if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) > -1) {
- h = calloc(1, sizeof(struct node_host));
- if (h == NULL)
- err(1, "address: calloc");
- h->ifname = NULL;
- h->af = AF_INET;
- h->addr.v.a.addr.addr32[0] = ina.s_addr;
- set_ipmask(h, bits);
- h->next = NULL;
- h->tail = h;
+ if (strrchr(s, '/') != NULL) {
+ if ((bits = inet_net_pton(AF_INET, s, &ina, sizeof(ina))) == -1)
+ return (NULL);
+ } else {
+ if (inet_pton(AF_INET, s, &ina) != 1)
+ return (NULL);
}
+
+ h = calloc(1, sizeof(struct node_host));
+ if (h == NULL)
+ err(1, "address: calloc");
+ h->ifname = NULL;
+ h->af = AF_INET;
+ h->addr.v.a.addr.addr32[0] = ina.s_addr;
+ set_ipmask(h, bits);
+ h->next = NULL;
+ h->tail = h;
return (h);
}
--
http://2suck.net/hhwl.html - http://www.bsws.de/
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)
Visit your host, monkey.org