[PATCH 3/4] stk: Fix possible NULL dereference

Max Rudik <[email protected]>
Newsgroups dev.linux.lists.ofono
Message-ID <[email protected]>
---
 src/stk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/stk.c b/src/stk.c
index 70e8ae30..083920a3 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -121,6 +121,9 @@ static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
 	if (stk->driver->terminal_response == NULL)
 		return -ENOSYS;
 
+	if (stk->pending_cmd == NULL)
+		return -EINVAL;
+
 	rsp->src = STK_DEVICE_IDENTITY_TYPE_TERMINAL;
 	rsp->dst = STK_DEVICE_IDENTITY_TYPE_UICC;
 	rsp->number = stk->pending_cmd->number;
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.