diff --git a/src/system/libroot/os/find_directory.cpp b/src/system/libroot/os/find_directory.cpp index 6ee1ca22df..0b944e80a3 100644 --- a/src/system/libroot/os/find_directory.cpp +++ b/src/system/libroot/os/find_directory.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -195,13 +196,14 @@ static const char *kUserDirectories[] = { static int create_path(const char *path, mode_t mode) { - char buffer[B_PATH_NAME_LENGTH + 1]; int pathLength; int i = 0; if (path == NULL || ((pathLength = strlen(path)) > B_PATH_NAME_LENGTH)) return EINVAL; + BStackOrHeapArray buffer(pathLength + 1); + while (++i < pathLength) { char *slash = strchr(&path[i], '/'); struct stat st;