logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: ca895e0a9a3326c49d58c501ff0790456f2507d5
parent 36816501ddd5601cb5bf2791a4903f9dd1014a5d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 29 Jul 2025 10:39:14 +0200

cmd/install: fix stack-use-after-scope found via clang AddressSanitizer

Diffstat:

Mcmd/install.c2+-
Mlibutils/lib_mkdir.c1-
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/cmd/install.c b/cmd/install.c @@ -345,9 +345,9 @@ main(int argc, char *argv[]) // Same as in mkdir_parents mode_t parent_mode = (S_IWUSR | S_IXUSR | ~mkdir_parents_filemask) & 0777; + char path_dup[PATH_MAX] = ""; if(!multi_src) { - char path_dup[PATH_MAX] = ""; strncpy(path_dup, dest, PATH_MAX); destdir = dirname(path_dup); diff --git a/libutils/lib_mkdir.c b/libutils/lib_mkdir.c @@ -15,7 +15,6 @@ int mkdir_parents(char *path, mode_t mode) { - for(int i = strlen(path) - 1; i >= 0; i--) { if(path[i] != '/') break;