perf: verify message length for msgTypeRegister

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
This commit is contained in:
Jianhui Zhao
2021-10-12 06:12:55 +00:00
parent 79f88f5671
commit 0e7632d113
+5
View File
@@ -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
}