]> Cypherpunks repositories - gostls13.git/commitdiff
- fix for out-of-bounds error found by rsc
authorRobert Griesemer <gri@golang.org>
Fri, 19 Sep 2008 17:56:35 +0000 (10:56 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 19 Sep 2008 17:56:35 +0000 (10:56 -0700)
- removed tests that may have wrong Go code from Makefile

R=r
OCL=15532
CL=15532

usr/gri/gosrc/platform.go
usr/gri/pretty/Makefile
usr/gri/pretty/platform.go

index c76d591505082c8d9253ca7f18a5791c35e2dad2..6e96b4ada1435972b4e3c94343dc7fe94e7b2e7a 100644 (file)
@@ -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 "="
                }
        }
index a6e355672e5350e5cea23472e4a06a2919813866..03f3e4f36fe3387f8951e61683c21f170821e134 100644 (file)
@@ -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
index c76d591505082c8d9253ca7f18a5791c35e2dad2..6e96b4ada1435972b4e3c94343dc7fe94e7b2e7a 100644 (file)
@@ -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 "="
                }
        }