summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2012-01-13 05:49:29 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2012-01-12 23:23:10 +0100
commit90656dbd00c32b56a6082d7baf4fc752adcf85dd (patch)
tree669b78384b829817dcb960695872d11ba5cd793d /src
parent6ecafef28f74ddae6c6db3458ca3d84179cdf953 (diff)
lapd: Warn if someone attempts to send an empty message
DATA REQ with a msgb_l3len(msg) == 0 message does not make any sense, log an error and return immediately before attempting to send an empty I frame in lapd_send_i.
Diffstat (limited to 'src')
-rw-r--r--src/gsm/lapd_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 74ffef30..fb79a2f0 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -1731,6 +1731,13 @@ static int lapd_data_req(struct osmo_dlsap_prim *dp, struct lapd_msg_ctx *lctx)
struct lapd_datalink *dl = lctx->dl;
struct msgb *msg = dp->oph.msg;
+ if (msgb_l3len(msg) == 0) {
+ LOGP(DLLAPD, LOGL_ERROR,
+ "writing an empty message is not possible.\n");
+ msgb_free(msg);
+ return -1;
+ }
+
LOGP(DLLAPD, LOGL_INFO,
"writing message to send-queue: l3len: %d\n", msgb_l3len(msg));