[PATCH] rewritten gsm 7 bit encoding

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Tue Jul 20 08:02:07 UTC 2010


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. :)




More information about the OpenBSC mailing list