1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:17:56 -07:00

net: fix crash in DialIP

Reported by jan.newmarch.

Fixes #1130.

R=r
CC=golang-dev
https://golang.org/cl/2212043
This commit is contained in:
Russ Cox 2010-09-24 16:50:50 -04:00
parent daf64bf567
commit b031b5cfde

View 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]