From 3df8101903089f326591a0d498fd865401441ae3 Mon Sep 17 00:00:00 2001 From: poornas Date: Tue, 12 Nov 2019 10:24:00 -0800 Subject: [PATCH] Fix encrypt-key flag parsing (#2955) --- cmd/common-methods.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/common-methods.go b/cmd/common-methods.go index 3c6eabf3..4afd3a78 100644 --- a/cmd/common-methods.go +++ b/cmd/common-methods.go @@ -54,6 +54,10 @@ func getDecodedKey(sseKeys string) (key string, err *probe.Error) { // Validate the key func parseKey(sseKeys string) (sse string, err *probe.Error) { encryptString := strings.SplitN(sseKeys, "=", 2) + if len(encryptString) < 2 { + return "", probe.NewError(errors.New("SSE-C prefix should be of the form prefix1=key1,... ")) + } + secretValue := encryptString[1] if len(secretValue) == 32 { return sseKeys, nil