From 150128005a4db8a9834ff1f9207fdf510f6b4705 Mon Sep 17 00:00:00 2001 From: Kacper Radoszewski Date: Tue, 28 May 2024 14:49:25 +0200 Subject: [PATCH] applications: serial_lte_modem: check for uninitialized send callback Calling slm_at_send_indicate() before the AT backend is initialized will dereference a NULL pointer, which may happen as several modules can dispatch custom notifications at any point. Signed-off-by: Kacper Radoszewski --- applications/serial_lte_modem/src/slm_at_host.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/applications/serial_lte_modem/src/slm_at_host.c b/applications/serial_lte_modem/src/slm_at_host.c index 13ee950070ab..85aac4e294b2 100644 --- a/applications/serial_lte_modem/src/slm_at_host.c +++ b/applications/serial_lte_modem/src/slm_at_host.c @@ -484,6 +484,9 @@ static int slm_at_send_indicate(const uint8_t *data, size_t len, if (k_is_in_isr()) { LOG_ERR("FIXME: Attempt to send AT response (of size %u) in ISR.", len); return -EINTR; + } else if (at_backend.send == NULL) { + LOG_ERR("Attempt to send via an uninitialized AT backend"); + return -EFAULT; } if (indicate) {