aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-03-26 19:54:29 +0100
committerlaforge <laforge@osmocom.org>2020-03-30 10:08:02 +0000
commitf5e275aec0c5a4c68cd62db838ba22ba7af7b664 (patch)
treeb600da3caca67e449cc4df1392d8489d8cd54afd
parent70a211747bf35084604edb6dce826cd178367920 (diff)
csn1: verify enough bits present to decode whole CSN_UINT_ARRAY
-rw-r--r--src/csn1.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/csn1.c b/src/csn1.c
index 1b3cc55..78444bb 100644
--- a/src/csn1.c
+++ b/src/csn1.c
@@ -338,7 +338,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec *vector
nCount = *pui16DATA(data, nCount);
}
- if (remaining_bits_len >= no_of_bits)
+ if (remaining_bits_len >= (no_of_bits * nCount))
{
remaining_bits_len -= (no_of_bits*nCount);
if (no_of_bits <= 8)
@@ -781,7 +781,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec *vector
nCount = *pui16DATA(data, nCount);
}
- if (remaining_bits_len >= no_of_bits)
+ if (remaining_bits_len >= (no_of_bits * nCount))
{
remaining_bits_len -= (no_of_bits * nCount);
if (no_of_bits <= 8)
@@ -1650,7 +1650,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec
nCount = *pui16DATA(data, nCount);
}
- if (remaining_bits_len >= no_of_bits)
+ if (remaining_bits_len >= (no_of_bits * nCount))
{
if (no_of_bits <= 8)
{
@@ -2067,7 +2067,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, struct bitvec
nCount = *pui16DATA(data, nCount);
}
- if (remaining_bits_len >= no_of_bits)
+ if (remaining_bits_len >= (no_of_bits * nCount))
{
if (no_of_bits <= 8)
{