[Mono-dev] System.dll few patches for review

Atsushi Eno atsushi at ximian.com
Thu Oct 5 15:51:29 EDT 2006


You are still wrong :-) InvariantCulture still causes culture
sensitive comparison.

Use String.CompareOrdinal() or CompareOptions.Ordinal instead.

Atsushi Eno

Andreas Nahr wrote:
> Sorry if this is already handled, just looked over the list and found this 
> bug:
> 
>>> Index: System.Net/DigestClient.cs
>>> ===================================================================
>>> --- System.Net/DigestClient.cs (revision 66034)
>>> +++ System.Net/DigestClient.cs (working copy)
>>> @@ -248,9 +248,9 @@
>>>  return false;
>>>  }
>>>
>>> - // build the hash object (only MD5 is defined in RFC2617)
>>> - if ((parser.Algorithm == null) || (parser.Algorithm.ToUpper 
>>> ().StartsWith ("MD5")))
>>> - hash = HashAlgorithm.Create ("MD5");
>>> + // build the hash object (only MD5 is defined in RFC2617)
>>> + if ((parser.Algorithm == null) || (parser.Algorithm.ToUpper 
>>> ().StartsWith ("MD5")))
>>> + hash = MD5.Create ();
>>>
>>>  return true;
>>>  }
> 
> Algorithm.ToUpper ().StartsWith ("MD5"))) is most likely wrong because the 
> code is doing a culture-sensitive uppercasing.
> You should use something like ToUpperInvariant or pass the Invariant Culture 
> (or better if possible: one of the case-insensitive compares)
> 
> I didn't look into the relevant classes, but there may be more similar 
> occurences of that problem.
> 
> mfg
> Andreas 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list