Commit b2797dc8 authored by Bryan C. Mills's avatar Bryan C. Mills Committed by Andrew Bonventre
Browse files

[release-branch.go1.13] cmd/go: do not append to the global cfg.OrigEnv slice

Appending to a global slice is only safe if its length is already
equal to its capacity. That property is not guaranteed for slices in
general, and empirically does not hold for this one.

This is a minimal fix to make it easier to backport.
A more robust cleanup of the base.EnvForDir function will be sent in a
subsequent CL.

Fixes #38082
Updates #38077

Change-Id: I731d5bbd0e516642c2cf43e713eeea15402604e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/225577


Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
Reviewed-by: default avatarMichael Matloob <matloob@golang.org>
(cherry picked from commit bfb1342a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/225660
parent d6224d38
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment