Change in libosmocore[master]: gsm48_decode_bcd_number2(): fix output truncation

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sat May 25 18:21:25 UTC 2019


Hello Harald Welte, Jenkins Builder, 

I'd like you to reexamine a change. Please visit

    https://gerrit.osmocom.org/14185

to look at the new patch set (#2).

Change subject: gsm48_decode_bcd_number2(): fix output truncation
......................................................................

gsm48_decode_bcd_number2(): fix output truncation

Thanks to the new unit test for BCD number encoding / decoding, it was
discovered that gsm48_decode_bcd_number2() does not properly handle
encoded LV if the output buffer size is equal to the original MSISDN
length + 1 (\0-terminator): one digit is lost.

For example, decoding of 15-digit long MSISDN to a buffer of size
16 (15 digits + 1 for \0) would give us only 14 digits.

The problem was that 'output_len' was being decremented before
checking the remaining buffer length and writing a digit to it.
As a result, the maximum length was always one byte shorter.

Change-Id: I61d49387fedbf7b238e21540a5eff22f6861e27a
Fixes: OS#4025
---
M src/gsm/gsm48_ie.c
M tests/gsm0408/gsm0408_test.ok
2 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/14185/2
-- 
To view, visit https://gerrit.osmocom.org/14185
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I61d49387fedbf7b238e21540a5eff22f6861e27a
Gerrit-Change-Number: 14185
Gerrit-PatchSet: 2
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190525/35854546/attachment.html>


More information about the gerrit-log mailing list