diff --git a/src/ssh_audit/software.py b/src/ssh_audit/software.py index 37f6dd4..02366c4 100644 --- a/src/ssh_audit/software.py +++ b/src/ssh_audit/software.py @@ -83,8 +83,8 @@ class Software: if not re.match(r'^test\d.*$', spatch): spatch = 'z{}'.format(spatch) elif self.product == Product.OpenSSH: - mx1 = re.match(r'^p\d(.*)', opatch) - mx2 = re.match(r'^p\d(.*)', spatch) + mx1 = re.match(r'^p(\d).*', opatch) + mx2 = re.match(r'^p(\d).*', spatch) if not (bool(mx1) and bool(mx2)): if mx1 is not None: opatch = mx1.group(1) diff --git a/test/test_version_compare.py b/test/test_version_compare.py index 367a07c..1eedf7d 100644 --- a/test/test_version_compare.py +++ b/test/test_version_compare.py @@ -136,13 +136,15 @@ class TestVersionCompare: s2 = self.get_openssh_software('2.1.1p2') assert s1.compare_version(s1) == 0 assert s2.compare_version(s2) == 0 - assert s1.compare_version('2.1.1p1') == 0 - assert s1.compare_version('2.1.1p2') == 0 - assert s2.compare_version('2.1.1') == 0 + assert s1.compare_version('2.1.1') == 0 + assert s2.compare_version('2.1.1p2') == 0 + assert s1.compare_version('2.1.1p1') != 0 + assert s1.compare_version('2.1.1p2') != 0 + assert s2.compare_version('2.1.1') != 0 assert s2.compare_version('2.1.1p1') > 0 assert s2.compare_version('2.1.1p3') < 0 - assert s1.compare_version(s2) == 0 - assert s2.compare_version(s1) == 0 + assert s1.compare_version(s2) != 0 + assert s2.compare_version(s1) != 0 def test_openbsd_compare_version_sequential(self): versions = []