From ed1b81b72bcc019445eb3f48370dddf37faec349 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 17 Sep 2016 11:15:00 +0200 Subject: [PATCH] Boot loader VFS: fix string termination error. The code was resetting the pointer to NULL, instead of setting the pointed char to null-terminate the string. The result was resolving the current directory later on, instead of the parent as requested. This only happened when calling open_from with O_CREAT, and a name with sub-directories inside it. The boot loader never does that, so the code wasn't used until now. Fixes #12941. Thanks to mt for spotting the problem. --- src/system/boot/loader/vfs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/boot/loader/vfs.cpp b/src/system/boot/loader/vfs.cpp index 8408970a4a..a136b6ce91 100644 --- a/src/system/boot/loader/vfs.cpp +++ b/src/system/boot/loader/vfs.cpp @@ -1044,7 +1044,7 @@ open_from(Directory *directory, const char *name, int mode, mode_t permissions) if (lastSlash[1] == '\0') return B_ENTRY_NOT_FOUND; - lastSlash = '\0'; + *lastSlash = '\0'; name = lastSlash + 1; // resolve the directory