Skip to content

Commit

Permalink
perf: verify message length for msgTypeRegister
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Oct 12, 2021
1 parent 79f88f5 commit 0e7632d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ func (dev *device) readLoop() {

switch typ {
case msgTypeRegister:
if msgLen < 2 {
log.Error().Msg("msgTypeRegister: invalid")
return
}

if !parseDeviceInfo(dev, b) {
return
}
Expand Down

0 comments on commit 0e7632d

Please sign in to comment.