From 9ab8aa393e2cd743591e3a20f2ee2535e9e038b2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 25 Sep 2010 03:10:42 -0700 Subject: [PATCH] Fix catpkgsplit() to validate the category part. This fixes vardbapi.cp_all() to reject invalid categories. --- pym/portage/versions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pym/portage/versions.py b/pym/portage/versions.py index e40866ef6..8ac32eb24 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -260,6 +260,7 @@ def _pkgsplit(mypkg): return (m.group('pn'), m.group('ver'), rev) +_cat_re = re.compile('^%s$' % _cat) _missing_cat = 'null' catcache={} def catpkgsplit(mydata,silent=1): @@ -288,7 +289,8 @@ def catpkgsplit(mydata,silent=1): p_split = _pkgsplit(mydata) elif len(mysplit)==2: cat = mysplit[0] - p_split = _pkgsplit(mysplit[1]) + if _cat_re.match(cat) is not None: + p_split = _pkgsplit(mysplit[1]) if not p_split: catcache[mydata]=None return None -- 2.26.2