diff options
Diffstat (limited to 'meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch')
-rw-r--r-- | meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch b/meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch new file mode 100644 index 0000000000..27b8863a4e --- /dev/null +++ b/meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 2aeb41a9a3a43b11b1e46628d0bf98197ff9f141 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Mackerras <paulus@ozlabs.org> | ||
3 | Date: Thu, 29 Dec 2022 18:00:20 +0100 | ||
4 | Subject: [PATCH] pppdump: Avoid out-of-range access to packet buffer | ||
5 | |||
6 | This fixes a potential vulnerability where data is written to spkt.buf | ||
7 | and rpkt.buf without a check on the array index. To fix this, we | ||
8 | check the array index (pkt->cnt) before storing the byte or | ||
9 | incrementing the count. This also means we no longer have a potential | ||
10 | signed integer overflow on the increment of pkt->cnt. | ||
11 | |||
12 | Fortunately, pppdump is not used in the normal process of setting up a | ||
13 | PPP connection, is not installed setuid-root, and is not invoked | ||
14 | automatically in any scenario that I am aware of. | ||
15 | |||
16 | Ustream-Status: Backport [https://github.com/ppp-project/ppp/commit/a75fb7b198eed50d769c80c36629f38346882cbf] | ||
17 | CVE: CVE-2022-4603 | ||
18 | Signed-off-by:Minjae Kim <flowergom@gmail.com> | ||
19 | --- | ||
20 | pppdump/pppdump.c | 7 ++++++- | ||
21 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/pppdump/pppdump.c b/pppdump/pppdump.c | ||
24 | index 87c2e8f..dec4def 100644 | ||
25 | --- a/pppdump/pppdump.c | ||
26 | +++ b/pppdump/pppdump.c | ||
27 | @@ -296,6 +296,10 @@ dumpppp(f) | ||
28 | printf("%s aborted packet:\n ", dir); | ||
29 | q = " "; | ||
30 | } | ||
31 | + if (pkt->cnt >= sizeof(pkt->buf)) { | ||
32 | + printf("%s over-long packet truncated:\n ", dir); | ||
33 | + q = " "; | ||
34 | + } | ||
35 | nb = pkt->cnt; | ||
36 | p = pkt->buf; | ||
37 | pkt->cnt = 0; | ||
38 | @@ -399,7 +403,8 @@ dumpppp(f) | ||
39 | c ^= 0x20; | ||
40 | pkt->esc = 0; | ||
41 | } | ||
42 | - pkt->buf[pkt->cnt++] = c; | ||
43 | + if (pkt->cnt < sizeof(pkt->buf)) | ||
44 | + pkt->buf[pkt->cnt++] = c; | ||
45 | break; | ||
46 | } | ||
47 | } | ||
48 | -- | ||
49 | 2.25.1 | ||
50 | |||