Skip to content

Commit 7e7eec3

Browse files
itxiaohu001huyongfeng
and
huyongfeng
authored
bugfix (#36)
* 使用本地漏洞库时报空指针错误 * Update vuln samples in readme * Update vuln samples in readme Co-authored-by: huyongfeng <[email protected]>
1 parent ff0ab0e commit 7e7eec3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ opensca-cli -db db.json -path ${project_path}
113113
"release_date": "2021-12-10",
114114
"security_level_id": 1,
115115
"exploit_level_id": 1
116-
},
117-
{}
116+
}
118117
]
119118
```
120119

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ opensca-cli -db db.json -path ${project_path}
112112
"release_date": "2021-12-10",
113113
"security_level_id": 1,
114114
"exploit_level_id": 1
115-
},
116-
{}
115+
}
117116
]
118117
```
119118

util/vuln/local.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ func loadVulnDB() {
3636
} else {
3737
// 解析本地漏洞
3838
db := []vulnInfo{}
39-
json.Unmarshal(data, &db)
39+
err := json.Unmarshal(data, &db)
40+
if err != nil {
41+
logs.Error(err)
42+
}
4043
for _, info := range db {
44+
if info.Vuln == nil {
45+
continue
46+
}
4147
// 有中文描述则省略英文描述
4248
if info.Description != "" {
4349
info.DescriptionEn = ""

0 commit comments

Comments
 (0)