diff mbox series

[3/4] stk: Fix possible NULL dereference

Message ID 20240716101136.44583-4-m.rudik@omp.ru (mailing list archive)
State Accepted
Commit a4efa493a6aa6def4e4555e5535af1a90cb6e49f
Headers show
Series Fix issues found with static analyzer | expand

Commit Message

Max Rudik July 16, 2024, 10:11 a.m. UTC
---
 src/stk.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

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;