Skip to content

Commit

Permalink
Fixes JuliaLang#18141, removing trailing null in ENV iterator on wind…
Browse files Browse the repository at this point in the history
…ows.
  • Loading branch information
twadleigh committed Aug 19, 2016
1 parent 6b6b3d8 commit 5045652
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ 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)
m = match(r"^(=?[^=]+)=(.*)$"s, env)
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
Expand Down

0 comments on commit 5045652

Please sign in to comment.