From 5045652e2ec3d6f9164304e5fc03d283a802fdbe Mon Sep 17 00:00:00 2001 From: Tracy Wadleigh Date: Fri, 19 Aug 2016 06:57:47 -0700 Subject: [PATCH] Fixes #18141, removing trailing null in ENV iterator on windows. --- base/env.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/env.jl b/base/env.jl index 78e2e0515145a..6482d7737c56e 100644 --- a/base/env.jl +++ b/base/env.jl @@ -91,7 +91,7 @@ if is_windows() function next(hash::EnvHash, block::Tuple{Ptr{UInt16},Ptr{UInt16}}) pos = block[1] blk = block[2] - len = ccall(:wcslen, UInt, (Ptr{UInt16},), pos) + 1 + len = ccall(:wcslen, UInt, (Ptr{UInt16},), pos) buf = Array{UInt16}(len) unsafe_copy!(pointer(buf), pos, len) env = transcode(String, buf) @@ -99,7 +99,7 @@ if is_windows() if m === nothing error("malformed environment entry: $env") end - return (Pair{String,String}(m.captures[1], m.captures[2]), (pos+len*2, blk)) + return (Pair{String,String}(m.captures[1], m.captures[2]), (pos+(len+1)*2, blk)) end else # !windows start(::EnvHash) = 0