]> Cypherpunks repositories - gostls13.git/commitdiff
net: fix crash in DialIP
authorRuss Cox <rsc@golang.org>
Fri, 24 Sep 2010 20:50:50 +0000 (16:50 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 24 Sep 2010 20:50:50 +0000 (16:50 -0400)
Reported by jan.newmarch.

Fixes #1130.

R=r
CC=golang-dev
https://golang.org/cl/2212043

src/pkg/net/iprawsock.go

index 92c299e4fc17531c81732d369827384330cb6298..241be150956bf45e05b200a7196fc182b786912e 100644 (file)
@@ -288,7 +288,7 @@ func readProtocols() {
 func netProtoSplit(netProto string) (net string, proto int, err os.Error) {
        onceReadProtocols.Do(readProtocols)
        i := last(netProto, ':')
-       if i+1 >= len(netProto) { // no colon
+       if i < 0 { // no colon
                return "", 0, os.ErrorString("no IP protocol specified")
        }
        net = netProto[0:i]