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:
parent
b4e783e6ff
commit
306babc6ac
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user