mirror of
https://github.com/golang/go
synced 2024-11-22 07:14:40 -07:00
- fix for out-of-bounds error found by rsc
- removed tests that may have wrong Go code from Makefile R=r OCL=15532 CL=15532
This commit is contained in:
parent
5eb9e0621b
commit
26adb31c30
@ -21,7 +21,7 @@ func GetEnv(key string) string {
|
||||
n := len(key);
|
||||
for i := 0; i < sys.envc(); i++ {
|
||||
v := sys.envv(i);
|
||||
if v[0 : n] == key {
|
||||
if n < len(v) && v[0 : n] == key && v[n] == '=' {
|
||||
return v[n + 1 : len(v)]; // +1: trim "="
|
||||
}
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ test: pretty
|
||||
pretty *.go
|
||||
pretty ../gosrc/*.go
|
||||
pretty $(GOROOT)/test/sieve.go
|
||||
pretty $(GOROOT)/test/bugs/*.go # some files legally don't compile
|
||||
pretty $(GOROOT)/test/fixedbugs/*.go # some files legally don't compile
|
||||
pretty $(GOROOT)/src/pkg/*.go
|
||||
pretty $(GOROOT)/src/lib/flag.go
|
||||
pretty $(GOROOT)/src/lib/fmt.go
|
||||
|
@ -21,7 +21,7 @@ func GetEnv(key string) string {
|
||||
n := len(key);
|
||||
for i := 0; i < sys.envc(); i++ {
|
||||
v := sys.envv(i);
|
||||
if v[0 : n] == key {
|
||||
if n < len(v) && v[0 : n] == key && v[n] == '=' {
|
||||
return v[n + 1 : len(v)]; // +1: trim "="
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user