From edf6fe75b72c10190057c65bdff467e5585ea6d7 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 26 Nov 2016 10:06:07 +0100 Subject: ctrl_cmd_parse: Make coverity FORWARD_NULL happy The 'strtok_r' function requires passing a NULL as the first parameter on subsequent calls in order to ensure the code picks up where it left off on a previous call. However, Coverity doesn't quite realize this and points out that if a NULL was passed in as the third argument it would result in a possible NULL deref because the strtok_r function will assign the third argument to the first in the call is NULL. Change-Id: I7a9d08d0d4eae76a5207d285e32a25d1b384a57f Fixes: Coverity CID 135186 --- src/ctrl/control_cmd.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index 3dbcf8f6..2cf66cf3 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -299,6 +299,7 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg) msgb_put_u8(msg, 0); str = (char *) msg->l2h; + OSMO_ASSERT(str); tmp = strtok_r(str, " ", &saveptr); if (!tmp) { cmd->type = CTRL_TYPE_ERROR; -- cgit v1.2.3