summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-07-25 10:16:46 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-07-25 10:18:56 +0200
commitb4aac955815912d04b24aa4cfb468e5e7f9b1bf5 (patch)
tree12550ddf26acbfc319d66d6aa1298e4af1bb6178
parentb2bc4dcb59d6ee75bed16ea2b57828a32fa7bcf6 (diff)
layer23: Alloc some headroom in incoming l1ctl packets
The upper layer will modify the headers and add somestuff in front, so it's needed to avoid corrupting memory. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--src/host/layer23/src/l1l2_interface.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/host/layer23/src/l1l2_interface.c b/src/host/layer23/src/l1l2_interface.c
index 3c359e84..f6d66bb5 100644
--- a/src/host/layer23/src/l1l2_interface.c
+++ b/src/host/layer23/src/l1l2_interface.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#define GSM_L2_LENGTH 256
+#define GSM_L2_HEADROOM 32
extern int quit;
@@ -46,7 +47,7 @@ static int layer2_read(struct bsc_fd *fd)
u_int16_t len;
int rc;
- msg = msgb_alloc(GSM_L2_LENGTH, "Layer2");
+ msg = msgb_alloc_headroom(GSM_L2_LENGTH+GSM_L2_HEADROOM, GSM_L2_HEADROOM, "Layer2");
if (!msg) {
LOGP(DL1C, LOGL_ERROR, "Failed to allocate msg.\n");
return -ENOMEM;