From 649605915428e0ee81cf49d15e949d48da20110c Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 30 Sep 2013 11:07:32 +0000 Subject: [PATCH] fix panic with wrong dockercfg file --- auth/auth.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/auth/auth.go b/auth/auth.go index 5c206f7d4e..58b5f92cab 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -91,11 +91,17 @@ func LoadConfig(rootPath string) (*ConfigFile, error) { } authConfig := AuthConfig{} origAuth := strings.Split(arr[0], " = ") + if len(origAuth) != 2 { + return &configFile, fmt.Errorf("Invalid Auth config file") + } authConfig.Username, authConfig.Password, err = decodeAuth(origAuth[1]) if err != nil { return &configFile, err } origEmail := strings.Split(arr[1], " = ") + if len(origEmail) != 2 { + return &configFile, fmt.Errorf("Invalid Auth config file") + } authConfig.Email = origEmail[1] authConfig.ServerAddress = IndexServerAddress() configFile.Configs[IndexServerAddress()] = authConfig