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

fix: Check wry db before query

This commit is contained in:
zu1k 2022-10-20 15:59:03 +08:00
parent b4e783e6ff
commit 306babc6ac
No known key found for this signature in database
GPG Key ID: AE381A8FB1EF2CC8
2 changed files with 8 additions and 0 deletions

View File

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

View File

@ -47,6 +47,10 @@ func NewZXwry(filePath string) (*ZXwry, error) {
counts := binary.LittleEndian.Uint64(header[8:16])
end := start + counts*11
if uint64(len(fileData)) < end {
log.Fatalln("ZX IPv6数据库存在错误请重新下载")
}
return &ZXwry{
IPDB: wry.IPDB[uint64]{
Data: fileData,