1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 21:29:02 +08:00

fix: check wry size before read header

This commit is contained in:
zu1k 2022-10-20 16:05:02 +08:00
parent 2da7512590
commit fc9df8dcf0
No known key found for this signature in database
GPG Key ID: AE381A8FB1EF2CC8
2 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,10 @@ func NewQQwry(filePath string) (*QQwry, error) {
} }
} }
if len(fileData) < 8 {
log.Fatalln("纯真 IP 库存在错误,请重新下载")
}
header := fileData[0:8] header := fileData[0:8]
start := binary.LittleEndian.Uint32(header[:4]) start := binary.LittleEndian.Uint32(header[:4])
end := binary.LittleEndian.Uint32(header[4:]) end := binary.LittleEndian.Uint32(header[4:])

View File

@ -39,6 +39,10 @@ func NewZXwry(filePath string) (*ZXwry, error) {
} }
} }
if len(fileData) < 24 {
log.Fatalln("ZX IPv6数据库存在错误请重新下载")
}
header := fileData[:24] header := fileData[:24]
offLen := header[6] offLen := header[6]
ipLen := header[7] ipLen := header[7]