From e7fa0e76fdd9af6ee0ca3e7c9cc29193944cedb4 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 11 Apr 2024 19:08:59 +0530 Subject: libnpass/util: fix off by one error --- src/libnpass/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libnpass/util.c b/src/libnpass/util.c index 04f2a37..182f117 100644 --- a/src/libnpass/util.c +++ b/src/libnpass/util.c @@ -15,9 +15,9 @@ int r_mkdir(const char *path, mode_t mode) int r; size_t len; char *p; - char tmp[NAME_MAX + 1]; + char tmp[NAME_MAX]; - strncpy(tmp, path, sizeof(tmp)); + strncpy(tmp, path, sizeof(tmp) - 1); len = strlen(tmp); if (tmp[len - 1] == '/') tmp[len - 1] = '\0'; -- cgit v1.2.3