summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-04-07 10:33:47 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-04-07 10:33:47 +0200
commitfe4990d74fb6ea9faa16a482a306d36c5b9ba64f (patch)
tree324b4c828e2238e781b7b3e8ccb7d5266f5ba85e
parent41ee4047ece99fccd2cf8913d55e70d31701bb37 (diff)
Fix: Allow TRX command with trailing '\0' and without
-rw-r--r--src/host/layer23/src/transceiver/trx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/host/layer23/src/transceiver/trx.c b/src/host/layer23/src/transceiver/trx.c
index 635532c1..678d20cf 100644
--- a/src/host/layer23/src/transceiver/trx.c
+++ b/src/host/layer23/src/transceiver/trx.c
@@ -437,9 +437,11 @@ _trx_ctrl_read_cb(struct osmo_fd *ofd, unsigned int what)
goto inval;
/* Check length */
- buf[l] = '\0'; /* Safety */
-
- if (strlen(buf) != (l-1))
+ if (buf[l-1] == '\0')
+ l--;
+ else
+ buf[l] = '\0'; /* Safety */
+ if (strlen(buf) != l)
goto inval;
/* Split command name and arguments */