Fix DoS attack vulnerability in CommandSwitchAccountFactory

This commit is contained in:
Shelikhoo 2021-12-05 19:15:38 +00:00 committed by yuhan6665
parent 4fc284a8e9
commit 6fb5c887b2
2 changed files with 22 additions and 1 deletions

View file

@ -139,7 +139,7 @@ func (f *CommandSwitchAccountFactory) Unmarshal(data []byte) (interface{}, error
}
cmd.Level = uint32(data[levelStart])
timeStart := levelStart + 1
if len(data) < timeStart {
if len(data) < timeStart+1 {
return nil, newError("insufficient length.")
}
cmd.ValidMin = data[timeStart]