authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-01-20 01:43:00-08:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2022-02-19 15:46:23-08:00
log83a486a064fdb7a533d2bdac6f8b4b0e42e46546
tree8754d5db73ff186d3bc1004e6effa94c0fcf5c78
parentc87f79c957a74fae16931a71d4c6414f9d58acf6

os.getenvW: Fix handling of special `=`-prefixed env vars


1 files changed, 6 insertions(+), 0 deletions(-)

lib/std/os.zig+6
...@@ -1726,6 +1726,12 @@ pub fn getenvW(key: [*:0]const u16) ?[:0]const u16 {...@@ -1726,6 +1726,12 @@ pub fn getenvW(key: [*:0]const u16) ?[:0]const u16 {
1726 while (ptr[i] != 0) {1726 while (ptr[i] != 0) {
1727 const key_start = i;1727 const key_start = i;
17281728
1729 // There are some special environment variables that start with =,
1730 // so we need a special case to not treat = as a key/value separator
1731 // if it's the first character.
1732 // https://devblogs.microsoft.com/oldnewthing/20100506-00/?p=14133
1733 if (ptr[key_start] == '=') i += 1;
1734
1729 while (ptr[i] != 0 and ptr[i] != '=') : (i += 1) {}1735 while (ptr[i] != 0 and ptr[i] != '=') : (i += 1) {}
1730 const this_key = ptr[key_start..i];1736 const this_key = ptr[key_start..i];
17311737