diff mbox series

[2/3] atmodem: ussd: ensure ussd content fits in buffer

Message ID 20241216102021.345566-2-absicsz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [1/3] util: ensure decode_hex_own_buf is passed a valid buffer | expand

Commit Message

Sicelo Dec. 16, 2024, 10:19 a.m. UTC
Fixes: CVE-2024-7539
---
 drivers/atmodem/ussd.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index 32a9fe91..775c74d1 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -121,6 +121,11 @@  static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
 
 	DBG("response charset %d modem charset %d", charset, data->charset);
 
+	if (strlen(content) > sizeof(msg) * 2)
+		status = 4; /* Not supported */
+		goto out;
+	}
+
 	switch (charset) {
 	case SMS_CHARSET_7BIT:
 		switch (data->charset) {