summaryrefslogtreecommitdiffstats
path: root/debian/patches/84_06-CVE-2020-28013-Heap-buffer-overflow-in-parse_fix_phr.patch
blob: 6acdeccfdd27365398a4e55ccacad310cd36e754 (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
From 0f6c3d3f7efb5d66dabf69c36e06912d89ff96fc Mon Sep 17 00:00:00 2001
From: Qualys Security Advisory <qsa@qualys.com>
Date: Sun, 21 Feb 2021 19:28:28 -0800
Subject: [PATCH 06/29] CVE-2020-28013: Heap buffer overflow in
 parse_fix_phrase()

Based on Phil Pennock's commit 8a50c88a.
---
 src/parse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/parse.c b/src/parse.c
index 4b0efa0e1..e1e2e7358 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -1149,9 +1149,12 @@ while (s < end)
             {
             if (ss >= end) ss--;
             *t++ = '(';
-            Ustrncpy(t, s, ss-s);
-            t += ss-s;
-            s = ss;
+            if (ss > s)
+              {
+              Ustrncpy(t, s, ss-s);
+              t += ss-s;
+              s = ss;
+              }
             }
           }
 
-- 
2.30.2