From 6bd2e8fe1e918403b93ef1ee985093d962ac2258 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Mon, 27 Jul 2020 16:33:01 +0100 Subject: [PATCH] Mitigation for https://github.com/cbeuw/Cloak-android/issues/13 --- internal/client/state.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/client/state.go b/internal/client/state.go index 9a4004f..995b437 100644 --- a/internal/client/state.go +++ b/internal/client/state.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "github.com/cbeuw/Cloak/internal/common" + log "github.com/sirupsen/logrus" "io/ioutil" "net" "strings" @@ -85,6 +86,10 @@ func ssvToJson(ssv string) (ret []byte) { break } sp := strings.SplitN(ln, "=", 2) + if len(sp) < 2 { + log.Errorf("Malformed config option: %v", ln) + continue + } key := sp[0] value := sp[1] // JSON doesn't like quotation marks around int and bool