aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-01-23 10:37:28 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2016-01-23 10:37:28 +0100
commit92efd03e87a97dd160446afa794bf94e0b9ad067 (patch)
treeb9cb21ccfbabc77efab237489b74af77d431d2de /examples
parent4d702db3f7a16c7aad20f799420c9a175194f722 (diff)
Do not use strlen on binary inpit
Coverity points out that buf might not be NULL terminated. For the memcpy ret was already used, so use ret for msgb_put as well. Fixes: CID#57922
Diffstat (limited to 'examples')
-rw-r--r--examples/stream-client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/stream-client.c b/examples/stream-client.c
index a1f57b0..112d78b 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -80,7 +80,7 @@ static int kbd_cb(struct osmo_fd *fd, unsigned int what)
LOGP(DSTREAMTEST, LOGL_ERROR, "cannot allocate message\n");
return 0;
}
- ptr = msgb_put(msg, strlen(buf));
+ ptr = msgb_put(msg, ret);
memcpy(ptr, buf, ret);
osmo_stream_cli_send(conn, msg);