From: Russ Cox Date: Fri, 24 Sep 2010 20:50:50 +0000 (-0400) Subject: net: fix crash in DialIP X-Git-Tag: weekly.2010-09-29~52 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b031b5cfdefb63c5dde1e6222729636d52a0b69d;p=gostls13.git net: fix crash in DialIP Reported by jan.newmarch. Fixes #1130. R=r CC=golang-dev https://golang.org/cl/2212043 --- diff --git a/src/pkg/net/iprawsock.go b/src/pkg/net/iprawsock.go index 92c299e4fc..241be15095 100644 --- a/src/pkg/net/iprawsock.go +++ b/src/pkg/net/iprawsock.go @@ -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]