2010-06-28 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 28 Jun 2010 22:15:34 +0000 (22:15 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 28 Jun 2010 22:15:34 +0000 (22:15 -0000)
* IPAddress.cs: verify the last IPv4 digit too.
Fixes bug #612135.

svn path=/trunk/mcs/; revision=159635

mcs/class/System/System.Net/ChangeLog
mcs/class/System/System.Net/IPAddress.cs

index 82d78eadcf410d0bdeba786dc3462a9b6503c098..77cb07a779833a63fe9cbb08b5eac8439328e96a 100644 (file)
@@ -1,3 +1,8 @@
+2010-06-28 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * IPAddress.cs: verify the last IPv4 digit too.
+       Fixes bug #612135.
+
 2010-06-16 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * HttpWebRequest.cs: DELETE allows an entity body.
index a375eaa7baf2d9e832ddf445b2c73e6af5afee15..eea47cd8ff9a1c8102dd74791e3c766c01d0a0e2 100644 (file)
@@ -282,10 +282,10 @@ namespace System.Net {
 #endif
                                        }
 
+                                       if (val > 0xFF)
+                                               return null; // e.g. 256.0.0.1
                                        if (i == (ips.Length - 1)) 
                                                i = 3;
-                                       else if (val > 0xFF)
-                                               return null; // e.g. 256.0.0.1
                                        for (int j = 0; val > 0; j++, val /= 0x100)
                                                a |= (val & 0xFF) << ((i - j) << 3);
                                }