From 0daf7af493fa7a2e3fb48144cce42a959c09ff35 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 20 Dec 2016 20:14:35 +0000 Subject: [PATCH] Fix getting path confstr, the returned size includes the zero terminator Closes #1047 --- src/shell_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell_manager.cc b/src/shell_manager.cc index f7857dab..f6623db3 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -25,7 +25,7 @@ ShellManager::ShellManager() // Get a guaranteed to be POSIX shell binary { auto size = confstr(_CS_PATH, 0, 0); - String path; path.resize(size, 0); + String path; path.resize(size-1, 0); confstr(_CS_PATH, path.data(), size); for (auto dir : StringView{path} | split(':')) {