aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-09-04 20:42:20 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2013-01-28 16:25:25 +0100
commit3d452a2ad0b990ba45dd3c642586bfdff59a3333 (patch)
treedb83be84b6f1492ec1b38f7c4a1b1b3a6a5288bd
parent577a3dacd8072c9f2535057d3ed82afa1c0902d7 (diff)
gbproxy: Address two unaligned memory access warnings
The lines 461 and 303 were producing unaligned memory access as the BVCI was not aligned properly. Introduce a tlvp_val16_unal to read 16bit from the data, use memcpy to the stack to make sure that it is working in the aligned and unaligned case.
-rw-r--r--openbsc/src/gprs/gb_proxy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index b99c455e2..69dde3d77 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -39,6 +39,13 @@
#include <openbsc/debug.h>
#include <openbsc/gb_proxy.h>
+static uint16_t tlvp_val16_unal(const struct tlv_parsed *tp, int pos)
+{
+ uint16_t res;
+ memcpy(&res, TLVP_VAL(tp, pos), sizeof(res));
+ return res;
+}
+
struct gbprox_peer {
struct llist_head list;