Password length

.NET library for SMPP protocol
Locked
juancri
Posts: 3
Joined: Wed Mar 16, 2011 1:22 am

Password length

Post by juancri » Wed Mar 16, 2011 4:09 pm

Hi:

I have been using the library and there's a problem in the file src/CS/PDU/Bind.cs

This:

Code: Select all

if(s.Length > 8)
{
     throw new System.ArgumentOutOfRangeException("Password","Length too long");
}
Should be replaced with with:

Code: Select all

if(s.Length > 9)
{
     throw new System.ArgumentOutOfRangeException("Password","Length too long");
}
Because the standard says the maximum length of the password is 9, not 8.
juancri
Posts: 3
Joined: Wed Mar 16, 2011 1:22 am

Re: Password length

Post by juancri » Thu Mar 17, 2011 3:59 am

Oh, now I see this note in the specs (page 36):
In the case of all C-Octet String formats, the maximum field size is shown as a
combination of string length and the NULL terminator, i.e., an 8-character C-Octet
String is encoded in 9 octets when the NULL terminator is included.
So I think the original code is right. Sorry! :)
Locked