From 21eaa8f164cba9fe6032a6a15de0c51ae1a16f8b Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 8 Sep 2018 12:18:26 +0200 Subject: [PATCH] configfile: return specific error on empty input Report the actual problem instead of a generic "unexpected end of JSON input". https://github.com/rfjakob/gocryptfs/issues/258 --- internal/configfile/config_file.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go index 4edf99d..31646ef 100644 --- a/internal/configfile/config_file.go +++ b/internal/configfile/config_file.go @@ -133,6 +133,9 @@ func Load(filename string, password []byte) ([]byte, *ConfFile, error) { if err != nil { return nil, nil, err } + if len(js) == 0 { + return nil, nil, fmt.Errorf("Config file is empty") + } // Unmarshal err = json.Unmarshal(js, &cf)