From d013d15fad1df0030bb5e279b265e530dba27ec9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 25 Jul 2010 14:59:56 -0700 Subject: [PATCH] Make extended_cp_match() use re.escape() for safety, and since the result is cached here anyway. --- pym/portage/dep/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 9720a510e..a8c647cee 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -765,8 +765,8 @@ def extended_cp_match(extended_cp, other_cp): global _extended_cp_re_cache extended_cp_re = _extended_cp_re_cache.get(extended_cp) if extended_cp_re is None: - extended_cp_re = re.compile("^" + extended_cp.replace( - "+", r"\+").replace(".", r"\.").replace('*', '[^/]*') + "$") + extended_cp_re = re.compile("^" + re.escape(extended_cp).replace( + r'\*', '[^/]*') + "$") _extended_cp_re_cache[extended_cp] = extended_cp_re return extended_cp_re.match(other_cp) is not None -- 2.26.2