From 51e22a478ac7205d9a88bd21e3b0cc0e62542179 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Tue, 23 Jan 2018 11:29:07 +0900 Subject: [PATCH] buildkitd: fix index-out-of-range panic in parsing wrong addr string Signed-off-by: Akihiro Suda --- cmd/buildkitd/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/buildkitd/main.go b/cmd/buildkitd/main.go index f43db8d3..0eff5e48 100644 --- a/cmd/buildkitd/main.go +++ b/cmd/buildkitd/main.go @@ -214,6 +214,10 @@ func serveGRPC(server *grpc.Server, addrs []string, errCh chan error) error { func getListener(addr string) (net.Listener, error) { addrSlice := strings.SplitN(addr, "://", 2) + if len(addrSlice) < 2 { + return nil, errors.Errorf("address %s does not contain proto, you meant unix://%s ?", + addr, addr) + } proto := addrSlice[0] listenAddr := addrSlice[1] switch proto {