Commit 26adb31c authored by Robert Griesemer's avatar Robert Griesemer

- 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
parent 5eb9e062
......@@ -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 "="
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment