From 77229effb5d97a48c99798f26f718ce65028ea9c Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 8 Nov 2018 10:02:24 +0100 Subject: [PATCH] expand: Fix get_home_directory_name This fixes the `~floam/` case, where the out_tail_idx pointer needs to point to the "/", not the last letter. The `~/` and `~floam` cases still work. Unfortunately, I'm unsure of how to test this. Fixes #5325. --- src/expand.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/expand.cpp b/src/expand.cpp index 52cf96bd9..2f4dc27a9 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -732,8 +732,8 @@ static wcstring get_home_directory_name(const wcstring &input, size_t *out_tail_ auto pos = input.find_first_of(L'/'); // We get the position of the /, but we need to remove it as well. if (pos != wcstring::npos) { - pos -= 1; *out_tail_idx = pos; + pos -= 1; } else { *out_tail_idx = input.length(); }