Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2008-03-20 23:58:38 UTC
Modified files:
Tag: u2_10_12_branch
ircd/test/ircd_in_addr_t.c ircd/ircd_string.c ChangeLog
Log message:
Do not accept strings like 0.0.0.0.0 as IP masks.
(Reported by the Quakenet crew: paulr, splidge, and company.)
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.230 ircu2.10/ChangeLog:1.710.2.231
--- ircu2.10/ChangeLog:1.710.2.230 Thu Mar 20 10:40:59 2008
+++ ircu2.10/ChangeLog Thu Mar 20 16:58:27 2008
@@ -1,3 +1,12 @@
+2008-03-20 Michael Poole <[EMAIL PROTECTED]>
+
+ * ircd/ircd_string.c (ircd_aton_ip4): Reject strings with more
+ than 3 dots in them.
+
+ * ircd/test/ircd_in_addr_t.c (test_addrs): Update the expected
+ parsing for a bare IPv4 address to a IPv4-mapped address.
+ (test_masks): Add a test for the ircd_string.c change.
+
2008-03-20 Kevin L. Mitchell <[EMAIL PROTECTED]>
* include/client.h: IsLocOp() now checks to see if its MyUser() as
Index: ircu2.10/ircd/ircd_string.c
diff -u ircu2.10/ircd/ircd_string.c:1.24.2.2
ircu2.10/ircd/ircd_string.c:1.24.2.3
--- ircu2.10/ircd/ircd_string.c:1.24.2.2 Mon Aug 20 19:02:10 2007
+++ ircu2.10/ircd/ircd_string.c Thu Mar 20 16:58:27 2008
@@ -18,7 +18,7 @@
*/
/** @file
* @brief Implementation of string operations.
- * @version $Id: ircd_string.c,v 1.24.2.2 2007/08/21 02:02:10 entrope Exp $
+ * @version $Id: ircd_string.c,v 1.24.2.3 2008/03/20 23:58:27 entrope Exp $
*/
#include "config.h"
@@ -481,9 +481,11 @@
*pbits = bits;
return pos;
case '.':
+ if (++dots > 3)
+ return 0;
if (input[++pos] == '.')
return 0;
- ip |= part << (24 - 8 * dots++);
+ ip |= part << (32 - 8 * dots);
part = 0;
if (input[pos] == '*') {
while (input[++pos] == '*' || input[pos] == '.') ;
Index: ircu2.10/ircd/test/ircd_in_addr_t.c
diff -u ircu2.10/ircd/test/ircd_in_addr_t.c:1.4.2.1
ircu2.10/ircd/test/ircd_in_addr_t.c:1.4.2.2
--- ircu2.10/ircd/test/ircd_in_addr_t.c:1.4.2.1 Mon Aug 20 19:02:10 2007
+++ ircu2.10/ircd/test/ircd_in_addr_t.c Thu Mar 20 16:58:27 2008
@@ -29,7 +29,7 @@
{{ 0, 0, 0, 0, 0, 0, 0, 1 }},
"AAAAAA", "_AAB", 1, 0, 1 },
{ "127.0.0.1", "127.0.0.1",
- {{ 0, 0, 0, 0, 0, 0, 0x7f00, 1 }},
+ {{ 0, 0, 0, 0, 0, 0xffff, 0x7f00, 1 }},
"B]AAAB", "B]AAAB", 1, 1, 1 },
{ "::ffff:127.0.0.3", "127.0.0.3",
{{ 0, 0, 0, 0, 0, 0xffff, 0x7f00, 3 }},
@@ -123,6 +123,7 @@
{ "a:*", {{ 0xa, 0, 0, 0, 0, 0, 0, 0 }}, 1, 1, 16 },
{ "a:*:*", {{ 0xa, 0, 0, 0, 0, 0, 0, 0 }}, 1, 1, 16 },
{ "a:/16", {{ 0xa, 0, 0, 0, 0, 0, 0, 0 }}, 1, 1, 16 },
+ { "0.0.0.0.0/1", {{ 0, 0, 0, 0, 0, 0, 0, 0 }}, 0, 0, 0 },
{ 0 }
};
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches