diff options
| -rw-r--r-- | meta/recipes-connectivity/ofono/ofono/CVE-2024-7539.patch | 88 | ||||
| -rw-r--r-- | meta/recipes-connectivity/ofono/ofono_1.34.bb | 1 |
2 files changed, 89 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/ofono/ofono/CVE-2024-7539.patch b/meta/recipes-connectivity/ofono/ofono/CVE-2024-7539.patch new file mode 100644 index 0000000000..46e45580c2 --- /dev/null +++ b/meta/recipes-connectivity/ofono/ofono/CVE-2024-7539.patch | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | From 389e2344f86319265fb72ae590b470716e038fdc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Sicelo A. Mhlongo" <absicsz@gmail.com> | ||
| 3 | Date: Tue, 17 Dec 2024 11:31:29 +0200 | ||
| 4 | Subject: [PATCH] ussd: ensure ussd content fits in buffers | ||
| 5 | |||
| 6 | Fixes: CVE-2024-7539 | ||
| 7 | |||
| 8 | CVE: CVE-2024-7539 | ||
| 9 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/ofono/ofono.git/commit/?id=389e2344f86319265fb72ae590b470716e038fdc] | ||
| 10 | |||
| 11 | Signed-off-by: Yogita Urade <yogita.urade@windriver.com> | ||
| 12 | --- | ||
| 13 | drivers/atmodem/ussd.c | 5 ++++- | ||
| 14 | drivers/huaweimodem/ussd.c | 5 ++++- | ||
| 15 | drivers/speedupmodem/ussd.c | 5 ++++- | ||
| 16 | 3 files changed, 12 insertions(+), 3 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c | ||
| 19 | index 3be1832..29f86dc 100644 | ||
| 20 | --- a/drivers/atmodem/ussd.c | ||
| 21 | +++ b/drivers/atmodem/ussd.c | ||
| 22 | @@ -106,7 +106,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 23 | const char *content; | ||
| 24 | int dcs; | ||
| 25 | enum sms_charset charset; | ||
| 26 | - unsigned char msg[160]; | ||
| 27 | + unsigned char msg[160] = {0}; | ||
| 28 | const unsigned char *msg_ptr = NULL; | ||
| 29 | long msg_len; | ||
| 30 | |||
| 31 | @@ -124,6 +124,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 32 | if (!g_at_result_iter_next_number(&iter, &dcs)) | ||
| 33 | dcs = 0; | ||
| 34 | |||
| 35 | + if (strlen(content) > sizeof(msg) * 2) | ||
| 36 | + goto out; | ||
| 37 | + | ||
| 38 | if (!cbs_dcs_decode(dcs, NULL, NULL, &charset, NULL, NULL, NULL)) { | ||
| 39 | ofono_error("Unsupported USSD data coding scheme (%02x)", dcs); | ||
| 40 | status = 4; /* Not supported */ | ||
| 41 | diff --git a/drivers/huaweimodem/ussd.c b/drivers/huaweimodem/ussd.c | ||
| 42 | index fbed3cd..4160b7d 100644 | ||
| 43 | --- a/drivers/huaweimodem/ussd.c | ||
| 44 | +++ b/drivers/huaweimodem/ussd.c | ||
| 45 | @@ -50,7 +50,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 46 | GAtResultIter iter; | ||
| 47 | int status, dcs; | ||
| 48 | const char *content; | ||
| 49 | - unsigned char msg[160]; | ||
| 50 | + unsigned char msg[160] = {0}; | ||
| 51 | const unsigned char *msg_ptr = NULL; | ||
| 52 | long msg_len; | ||
| 53 | |||
| 54 | @@ -68,6 +68,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 55 | if (!g_at_result_iter_next_number(&iter, &dcs)) | ||
| 56 | dcs = 0; | ||
| 57 | |||
| 58 | + if (strlen(content) > sizeof(msg) * 2) | ||
| 59 | + goto out; | ||
| 60 | + | ||
| 61 | msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); | ||
| 62 | |||
| 63 | out: | ||
| 64 | diff --git a/drivers/speedupmodem/ussd.c b/drivers/speedupmodem/ussd.c | ||
| 65 | index 57b91d7..99af19a 100644 | ||
| 66 | --- a/drivers/speedupmodem/ussd.c | ||
| 67 | +++ b/drivers/speedupmodem/ussd.c | ||
| 68 | @@ -49,7 +49,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 69 | GAtResultIter iter; | ||
| 70 | int status, dcs; | ||
| 71 | const char *content; | ||
| 72 | - unsigned char msg[160]; | ||
| 73 | + unsigned char msg[160] = {0}; | ||
| 74 | const unsigned char *msg_ptr = NULL; | ||
| 75 | long msg_len; | ||
| 76 | |||
| 77 | @@ -67,6 +67,9 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd) | ||
| 78 | if (!g_at_result_iter_next_number(&iter, &dcs)) | ||
| 79 | dcs = 0; | ||
| 80 | |||
| 81 | + if (strlen(content) > sizeof(msg) * 2) | ||
| 82 | + goto out; | ||
| 83 | + | ||
| 84 | msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg); | ||
| 85 | |||
| 86 | out: | ||
| 87 | -- | ||
| 88 | 2.40.0 | ||
diff --git a/meta/recipes-connectivity/ofono/ofono_1.34.bb b/meta/recipes-connectivity/ofono/ofono_1.34.bb index 3ffb713472..a7c3a9085d 100644 --- a/meta/recipes-connectivity/ofono/ofono_1.34.bb +++ b/meta/recipes-connectivity/ofono/ofono_1.34.bb | |||
| @@ -18,6 +18,7 @@ SRC_URI = "\ | |||
| 18 | file://CVE-2023-2794-0002.patch \ | 18 | file://CVE-2023-2794-0002.patch \ |
| 19 | file://CVE-2023-2794-0003.patch \ | 19 | file://CVE-2023-2794-0003.patch \ |
| 20 | file://CVE-2023-2794-0004.patch \ | 20 | file://CVE-2023-2794-0004.patch \ |
| 21 | file://CVE-2024-7539.patch \ | ||
| 21 | " | 22 | " |
| 22 | SRC_URI[sha256sum] = "c0b96d3013447ec2bcb74579bef90e4e59c68dbfa4b9c6fbce5d12401a43aac7" | 23 | SRC_URI[sha256sum] = "c0b96d3013447ec2bcb74579bef90e4e59c68dbfa4b9c6fbce5d12401a43aac7" |
| 23 | 24 | ||
