From 9e2ce27f0863b6f8193329b4031eaa777106095a Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 26 Nov 2017 17:53:24 +1300 Subject: [PATCH] adc: fix length detection in password challenge nonce --HG-- branch : adc --- AdcProtocol.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AdcProtocol.go b/AdcProtocol.go index e079df9..a19c3ed 100644 --- a/AdcProtocol.go +++ b/AdcProtocol.go @@ -78,6 +78,7 @@ func (this *AdcProtocol) ProcessCommand(msg string) { } this.hc.processEvent(HubEvent{EventType: EVENT_DEBUG_MESSAGE, Message: msg}) + parts := strings.Split(msg, " ") switch parts[0] { @@ -298,8 +299,8 @@ func (this *AdcProtocol) ProcessCommand(msg string) { */ data_base32 := parts[1] - if len(data_base32)%5 != 0 { - data_base32 += strings.Repeat("=", 6-(len(data_base32)%5)) + if len(data_base32)%8 != 0 { + data_base32 += strings.Repeat("=", 8-(len(data_base32)%8)) } data_raw, err := base32.StdEncoding.DecodeString(data_base32)