Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2010-07-15 00:30:22 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2010-07-15 00:30:22 +0400
commit1814e5864d9dd1da28be9455994fd88f7a805135 (patch)
treec3fa04feefa1b4d5f426ae115af100dd1adb33d0
parentf9aca58e82297d431a624d6718b2cc9b26fae375 (diff)
2010-07-14 Gonzalo Paniagua Javier <gonzalo@novell.com>
* IPAddress.cs: allow values out of range as MS does. svn path=/trunk/mcs/; revision=160379
-rw-r--r--mcs/class/System/System.Net/ChangeLog4
-rw-r--r--mcs/class/System/System.Net/IPAddress.cs10
2 files changed, 11 insertions, 3 deletions
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index 4cdd26aac0d..06b8b0b37aa 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-14 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+ * IPAddress.cs: allow values out of range as MS does.
+
2010-07-08 Gonzalo Paniagua Javier <gonzalo@novell.com>
* WebClient.cs: handle compressed streams when automatic decompression
diff --git a/mcs/class/System/System.Net/IPAddress.cs b/mcs/class/System/System.Net/IPAddress.cs
index eea47cd8ff9..121b29ccf88 100644
--- a/mcs/class/System/System.Net/IPAddress.cs
+++ b/mcs/class/System/System.Net/IPAddress.cs
@@ -282,10 +282,14 @@ namespace System.Net {
#endif
}
- if (val > 0xFF)
- return null; // e.g. 256.0.0.1
- if (i == (ips.Length - 1))
+ if (i == (ips.Length - 1)) {
+ if (i != 0 && val >= (256 << ((3 - i) * 8)))
+ return null;
+ else if (val > 0x3fffffffe) // this is the last number that parses correctly with MS
+ return null;
i = 3;
+ } else if (val >= 0x100)
+ return null;
for (int j = 0; val > 0; j++, val /= 0x100)
a |= (val & 0xFF) << ((i - j) << 3);
}