Skip to content

Commit 08a27fc

Browse files
committed
fix: update gettext checker
- Update gettext pattern to catch version in debian, fedora and openwrt packages - Correctly catch 4 digits version (i.e. do not catch 0.19.8 instead of 0.19.8.1) Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent f0393f0 commit 08a27fc

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

cve_bin_tool/checkers/gettext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
class GettextChecker(Checker):
1717
CONTAINS_PATTERNS: list[str] = []
1818
FILENAME_PATTERNS: list[str] = []
19-
VERSION_PATTERNS = [r"/gettext-([0-9]+\.[0-9]+\.[0-9]+)(?:\.[0-9]+)?[-/]"]
19+
VERSION_PATTERNS = [r"gettext[A-Za-z:\-\r\n]*([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)"]
2020
VENDOR_PRODUCT = [("gnu", "gettext")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/gettext.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
mapping_test_data = [
55
{
66
"product": "gettext",
7-
"version": "0.19.8",
7+
"version": "0.19.8.1",
88
"version_strings": [
99
"../../../gettext-0.19.8.1/gettext-tools/gnulib-lib/mbiter.h"
1010
],
@@ -25,4 +25,22 @@
2525
"version": "0.22.3",
2626
"other_products": ["gcc"],
2727
},
28+
{
29+
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/g/",
30+
"package_name": "gettext-0.23.1-2.fc42.aarch64.rpm",
31+
"product": "gettext",
32+
"version": "0.23.1",
33+
},
34+
{
35+
"url": "http://ftp.debian.org/debian/pool/main/g/gettext/",
36+
"package_name": "gettext_0.19.8.1-9_amd64.deb",
37+
"product": "gettext",
38+
"version": "0.19.8.1",
39+
},
40+
{
41+
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/",
42+
"package_name": "gettext-0.20.1-r2.apk",
43+
"product": "gettext",
44+
"version": "0.20.1",
45+
},
2846
]

0 commit comments

Comments
 (0)