blob: e1ef97d981dcd9046723a786bc918cfcadc960f7 (
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
|
From cc45b55f895d0c21b5ac3e5a65b0bf00f76adeb7 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 8 Oct 2021 04:52:55 +0100
Subject: [PATCH 1/2] checkpath: fix allocation size of path buffer
strlen's return value isn't enough to be used
directly for (x)malloc; it doesn't include
the null byte at the end of the string.
X-Gentoo-Bug: 816900
X-Gentoo-Bug-URL: https://bugs.gentoo.org/816900
Fixes: #459
Fixes: #462
---
src/rc/checkpath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c
index bab22692..c4dd7d9d 100644
--- a/src/rc/checkpath.c
+++ b/src/rc/checkpath.c
@@ -151,7 +151,7 @@ static char *clean_path(char *path)
char *ch;
char *ch2;
char *str;
- str = xmalloc(strlen(path));
+ str = xmalloc(strlen(path) + 1);
ch = path;
ch2 = str;
while (true) {
--
2.32.0
|