aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/os/env.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index ac442ee2e8..360609c50d 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -302,7 +302,10 @@ char *os_getenvname_at_index(size_t index)
break;
}
- const char * const end = strchr(utf8_str, '=');
+ // Some Windows env vars start with =, so skip over that to find the
+ // separator between name/value
+ const char * const end = strchr(utf8_str + (utf8_str[0] == '=' ? 1 : 0),
+ '=');
assert(end != NULL);
ptrdiff_t len = end - utf8_str;
assert(len > 0);