tFix off-by-one error when copying root path - pm - barely a pack manager
(HTM) git clone git://z3bra.org/pm
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2011fb1d06f4a9330433f084a251b4a77162ca67
(DIR) parent 76c3f28f7015a81b45e92a9779c336bf63adc5fc
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Fri, 29 May 2020 19:16:13 +0200
Fix off-by-one error when copying root path
Diffstat:
M pm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/pm.c b/pm.c
t@@ -941,8 +941,8 @@ main (int argc, char **argv)
char rootfs[PATH_MAX] = "";
char datadir[PATH_MAX] = "";
- strncpy(rootfs, PACK_ROOT, PATH_MAX);
- strncat(rootfs, "/", PATH_MAX);
+ strncpy(rootfs, PACK_ROOT, PATH_MAX -1);
+ strncat(rootfs, "/", PATH_MAX - 1);
strncpy(datadir, PACK_DATA, PATH_MAX);
ARGBEGIN{