Skip to content

Commit c5b30f1

Browse files
authored
improved Coverage for gnutls (#598)
1 parent 42b4593 commit c5b30f1

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

cve_bin_tool/checkers/gnutls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def get_version(lines, filename):
1919
"""
2020
regex = [r"gnutls-cli ([0-9]+\.[0-9]+\.[0-9]+)"]
2121
version_info = dict()
22-
version = "UNKNOWN"
22+
# regex_find() returns version if found otherwise returns "UNKNOWN"
2323
version = regex_find(lines, *regex)
2424

2525
for modulename, binary_names in (
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
printf("This program is designed to test the cve-bin-tool checker.");
5+
printf("It outputs a few strings normally associated with gnutls-cli 2.1.6");
6+
printf("They appear below this line.");
7+
printf("------------------");
8+
printf("gnutls-cli 2.1.6");
9+
10+
return 0;
11+
}

test/test_scanner.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,23 @@ def _file_test(self, url, filename, package, version):
820820
"CVE-2019-3836",
821821
],
822822
),
823+
(
824+
"test-gnutls_cli-2.1.6_imprv_covrg.out",
825+
"gnutls-cli",
826+
"2.1.6",
827+
[
828+
# known cves in 2.1.6
829+
"CVE-2009-2730",
830+
"CVE-2009-2409",
831+
"CVE-2009-1417",
832+
],
833+
[
834+
# an older cve from before 2.1.6
835+
"CVE-2004-2531",
836+
# an newer cve from after 2.1.6
837+
"CVE-2019-3836",
838+
],
839+
),
823840
(
824841
"test-gnutls-serv-2.1.6.out",
825842
"gnutls-cli",

0 commit comments

Comments
 (0)