diff options
author | Sam James <sam@gentoo.org> | 2021-10-08 04:52:55 +0100 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2021-10-07 23:00:49 -0500 |
commit | bb8334104baf4d5a4a442a8647fb9204738f2204 (patch) | |
tree | 92e4d07262f11af48c6fc2746e43b66d08e78407 /src | |
parent | 6b9a5b8271a4880a3b1f94d122a66e0c2cc95c93 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/rc/checkpath.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |