adc: fix length detection in password challenge nonce

--HG--
branch : adc
This commit is contained in:
mappu 2017-11-26 17:53:24 +13:00
parent d392cd379d
commit 9e2ce27f08
1 changed files with 3 additions and 2 deletions

View File

@ -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)