From b031b5cfdefb63c5dde1e6222729636d52a0b69d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 24 Sep 2010 16:50:50 -0400 Subject: [PATCH] net: fix crash in DialIP Reported by jan.newmarch. Fixes #1130. R=r CC=golang-dev https://golang.org/cl/2212043 --- src/pkg/net/iprawsock.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg/net/iprawsock.go b/src/pkg/net/iprawsock.go index 92c299e4fc1..241be150956 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]