On 07/20/2010 05:05 AM, Nico Golde wrote:
I just looked into this and if I'm not mistaken
this is no
bug in the encoding but just a bug when comparing the
encoded result. The current code memcmp's n bytes where n is
the result of gsm_7bit_encode() with the input string
bytewise. The problem with this is that the function returns
the number of septets not octets. Attached is a patch for
the test code that should fix this.
Hi Nico,
I don't think using strlen is correct. The gsm_7bit_encode
method makes no promise that the result will have a null
byte at the end, in fact nothing in this method will add a
null byte, and the null byte in the output is only present
because of memset in the calling method.
I think gsm_7bit_encode should return the length of bytes
it has written to, not more. :)
PS: The gsm_7bit_encode usage in gsm_04_08.c is wrong. :)