[eggheads-patches] PATCH: tstip.patch

Peter 'Rattacresh' Backes rtc at rhrk.uni-kl.de
Wed Oct 6 14:40:29 CST 1999


This patch modifies testip from alltools.tcl to not recognize octal, 
broadcast and network addresses as valid ones although they are.
For toths paranoia.


-- Peter 'Rattacresh' Backes, rtc at rhrk.uni-kl.de

-------------- next part --------------
diff -urN eggdrop1.3.29/scripts/alltools.tcl eggdrop1.3.29+tstip/scripts/alltools.tcl
--- eggdrop1.3.29/scripts/alltools.tcl	Wed Oct  6 16:36:48 1999
+++ eggdrop1.3.29+tstip/scripts/alltools.tcl	Wed Oct  6 16:49:05 1999
@@ -9,6 +9,7 @@
 # more changes from Tothwolf 24/25May1999
 # reversed some of these weird changes and more fixes by rtc 20Sep1999
 # version for 1.3 bots only by rtc 24Sep1999
+# testip fixes by rtc 06Oct1999
 
 ########################################
 # Descriptions of avaliable commands:
@@ -148,11 +149,16 @@
   set testhost [split $address "."]
   if {[llength $testhost] != 4} {return 0}
   foreach part $testhost {
+    set length [string length $part]
     # >= 0 is just for undertandability, not really needed.
-    if {[string length $part] > 3 || ![isnumber $part] || !($part >= 0 && $part <= 255)} {
+    if {$length > 3 ||
+        ($length > 1 && [string index $part 0] == "0") ||
+        ![isnumber $part] || 
+        !($part >= 0 && $part <= 255)} {
       return 0
     }
   }
+  if {$part == 0 || $part == 255} {return 0}
   return 1
 }
 


More information about the Patches mailing list