diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-07-04 09:44:47 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2013-07-06 23:36:16 +0200 |
commit | f996b05dbddccb8e8788dd69777a4fedfa2373eb (patch) | |
tree | bf866bff5c88a8079edd40362b88424d072a3605 /src | |
parent | c62a1bf4d53edec94b0db05da717d24438824357 (diff) |
Fix encoding of last character at 7bit encoding function
To avoid the situation where the receiving entity confuses 7 binary zero pad
bits as the @ character, the carriage return or <CR> character shall be used
for padding in this situation.
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/gsm_utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c index 9569cf32..fa77eae4 100644 --- a/src/gsm/gsm_utils.c +++ b/src/gsm/gsm_utils.c @@ -241,6 +241,12 @@ int gsm_septets2octets(uint8_t *result, const uint8_t *rdata, uint8_t septet_len result[z++] = cb; shift++; } + /* To avoid the situation where the receiving entity confuses 7 binary + * zero pad bits as the @ character, the carriage return or <CR> + * character (defined in subclause 7.1.1) shall be used for padding in + * this situation. */ + if (shift == 7) + result[z - 1] |= 0x1a; free(data); |