aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Kluchnikov <kluchnikovi@gmail.com>2013-12-30 14:26:06 +0400
committerDaniel Willmann <daniel@totalueberwachung.de>2014-01-09 20:01:48 +0100
commit402cdcd02f5de56a590308ced83e7395bbe7eda8 (patch)
tree1df343e39e385205a793a35c66c5bd6b0f836503
parent2f1974b5ac38a6f0a56a0607338f9ffa4c6cc691 (diff)
Fix warnings in gsm_rlcmac.cpp
1. ar.direction variable was not initialized 2. overrunning array "data->RLC_DATA" of 20 bytes at byte offset 22 using index "i" (which evaluates to 22)
-rw-r--r--src/csn1.cpp1
-rw-r--r--src/gsm_rlcmac.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/csn1.cpp b/src/csn1.cpp
index 45cc848..7f64823 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -89,6 +89,7 @@ csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len)
{
ar->remaining_bits_len = remaining_bits_len;
ar->bit_offset = bit_offset;
+ ar->direction = 0;
}
static const char* ErrCodes[] =
diff --git a/src/gsm_rlcmac.cpp b/src/gsm_rlcmac.cpp
index a39a5c0..44bc5e1 100644
--- a/src/gsm_rlcmac.cpp
+++ b/src/gsm_rlcmac.cpp
@@ -34,6 +34,7 @@
*/
#include <iostream>
#include <cstdlib>
+#include <assert.h>
#include <gprs_debug.h>
using namespace std;
@@ -5436,6 +5437,7 @@ void decode_gsm_rlcmac_uplink_data(bitvec * vector, RlcMacUplinkDataBlock_t * da
}
unsigned dataLen = 23 - readIndex/8;
LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataLen);
+ assert(dataLen <= 20);
for (unsigned i = 0; i < dataLen; i++)
{
data->RLC_DATA[i] = bitvec_read_field(vector, readIndex, 8);
@@ -5498,6 +5500,7 @@ void encode_gsm_rlcmac_downlink_data(bitvec * vector, RlcMacDownlinkDataBlock_t
}
unsigned dataNumOctets = 23 - writeIndex/8;
LOGPC(DRLCMACDATA, LOGL_NOTICE, "DATA[%u] = ", dataNumOctets);
+ assert(dataNumOctets <= 20);
for (unsigned i = 0; i < dataNumOctets; i++)
{
bitvec_write_field(vector, writeIndex, data->RLC_DATA[i], 8);