From: Robert Griesemer Date: Fri, 19 Sep 2008 17:56:35 +0000 (-0700) Subject: - fix for out-of-bounds error found by rsc X-Git-Tag: weekly.2009-11-06~3170 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=26adb31c30252d7a1821f920b845ae35dd9efa3f;p=gostls13.git - 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 --- diff --git a/usr/gri/gosrc/platform.go b/usr/gri/gosrc/platform.go index c76d591505..6e96b4ada1 100644 --- a/usr/gri/gosrc/platform.go +++ b/usr/gri/gosrc/platform.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 "=" } } diff --git a/usr/gri/pretty/Makefile b/usr/gri/pretty/Makefile index a6e355672e..03f3e4f36f 100644 --- a/usr/gri/pretty/Makefile +++ b/usr/gri/pretty/Makefile @@ -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 diff --git a/usr/gri/pretty/platform.go b/usr/gri/pretty/platform.go index c76d591505..6e96b4ada1 100644 --- a/usr/gri/pretty/platform.go +++ b/usr/gri/pretty/platform.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 "=" } }