summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/ofono/ofono/CVE-2023-4234.patch
blob: 9d7b56c1ae1f7047fc8dc6e82a64c860dfdbf9c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 8d74bc66146ea78620d140640a0a57af86fc8936 Mon Sep 17 00:00:00 2001
From: Denis Grigorev <d.grigorev@omp.ru>
Date: Thu, 21 Dec 2023 17:16:38 +0300
Subject: [PATCH] smsutil: Check that submit report fits in memory

This addresses CVE-2023-4234.

CVE: CVE-2023-4234.

Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/ofono/ofono.git/commit/?id=8d74bc66146ea786]

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
---
 src/smsutil.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/smsutil.c b/src/smsutil.c
index 8e57a06..5a12708 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -938,10 +938,16 @@ static gboolean decode_submit_report(const unsigned char *pdu, int len,
			return FALSE;

		if (out->type == SMS_TYPE_SUBMIT_REPORT_ERROR) {
+			if (expected > (int) sizeof(out->submit_err_report.ud))
+                                return FALSE;
+
			out->submit_err_report.udl = udl;
			memcpy(out->submit_err_report.ud,
					pdu + offset, expected);
		} else {
+			if (expected > (int) sizeof(out->submit_ack_report.ud))
+                                return FALSE;
+
			out->submit_ack_report.udl = udl;
			memcpy(out->submit_ack_report.ud,
					pdu + offset, expected);
--
2.40.0