driverutil: uses SplitN to parse user input

Signed-off-by: André Carvalho <andre.carvalho@corp.globo.com>
This commit is contained in:
André Carvalho 2016-08-22 09:32:33 -03:00 committed by Misty Stanley-Jones
parent a171962328
commit 716a8d133f
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import "strings"
// SplitPortProto splits a string in the format port/protocol, defaulting // SplitPortProto splits a string in the format port/protocol, defaulting
// protocol to "tcp" if not provided. // protocol to "tcp" if not provided.
func SplitPortProto(raw string) (port string, protocol string, err error) { func SplitPortProto(raw string) (port string, protocol string, err error) {
parts := strings.Split(raw, "/") parts := strings.SplitN(raw, "/", 2)
if len(parts) == 1 { if len(parts) == 1 {
protocol = "tcp" protocol = "tcp"
} else { } else {