summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch')
-rw-r--r--meta/recipes-connectivity/ppp/ppp/CVE-2022-4603.patch50
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 @@
1From 2aeb41a9a3a43b11b1e46628d0bf98197ff9f141 Mon Sep 17 00:00:00 2001
2From: Paul Mackerras <paulus@ozlabs.org>
3Date: Thu, 29 Dec 2022 18:00:20 +0100
4Subject: [PATCH] pppdump: Avoid out-of-range access to packet buffer
5
6This fixes a potential vulnerability where data is written to spkt.buf
7and rpkt.buf without a check on the array index. To fix this, we
8check the array index (pkt->cnt) before storing the byte or
9incrementing the count. This also means we no longer have a potential
10signed integer overflow on the increment of pkt->cnt.
11
12Fortunately, pppdump is not used in the normal process of setting up a
13PPP connection, is not installed setuid-root, and is not invoked
14automatically in any scenario that I am aware of.
15
16Ustream-Status: Backport [https://github.com/ppp-project/ppp/commit/a75fb7b198eed50d769c80c36629f38346882cbf]
17CVE: CVE-2022-4603
18Signed-off-by:Minjae Kim <flowergom@gmail.com>
19---
20 pppdump/pppdump.c | 7 ++++++-
21 1 file changed, 6 insertions(+), 1 deletion(-)
22
23diff --git a/pppdump/pppdump.c b/pppdump/pppdump.c
24index 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--
492.25.1
50