[Mono-list] Bug in RFCFilter in Namespace Novell.Directory.Ldap.Rfc2251

Fischer Tobias T.Fischer at servonic.de
Wed Apr 28 12:04:28 EDT 2010


Hi,

i have found a bug in the implementation of RFCFilter in Namespace
Novell.Directory.Ldap.Rfc2251 which is used by the directory searcher.

The affected function is:
  private sbyte[] unescapeString(System.String string_Renamed)

This function does some string encoding and returns the encoded string
as a sbyte array.

This bug in this function is the following:

If string_Renamed contains none US-ASCII Characters (ASCII 7-bit)
"unescapeString" encodes them to UTF-8
But the string returned in the sbyte array does not contain them,
instead it contains null values for every none US-ASCII Char.

If have traced down the problem to the following line:
  
  Array.Copy((System.Array) SupportClass.ToByteArray(utf8Bytes), 0,
(System.Array)SupportClass.ToByteArray( octets), iOctets,
utf8Bytes.Length);

Here the converted Character (contained in utf8Bytes) should be copied
to octets, but SupportClass.ToByteArray does not return a reference to
octets but a new copy.
Since then octets does never receive the encoded bytes -> returned value
doesn't contain non US-ASCII Chars anymore.

I think I can fix this bug, but I do not know how to commit my fix.
Should I create a patch (using tortoise svn) and just submit it to this
list or have I to do something else?
Since this is a private function I also do not know how to write a test
for this behavior.


Thanks in advance

Tobias Fischer


More information about the Mono-list mailing list