From b3cfb2065ccbeb8f769d630ff997c0327fb2eb35 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 11 Feb 2012 19:39:10 -0800 Subject: [PATCH] xpak.unpackinfo: validate paths, bug #403149 --- pym/portage/xpak.py | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/pym/portage/xpak.py b/pym/portage/xpak.py index b507243c4..db2a2bc9e 100644 --- a/pym/portage/xpak.py +++ b/pym/portage/xpak.py @@ -1,4 +1,4 @@ -# Copyright 2001-2011 Gentoo Foundation +# Copyright 2001-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -246,16 +246,9 @@ def getitem(myid,myitem): return mydata[myloc[0]:myloc[0]+myloc[1]] def xpand(myid,mydest): + mydest = normalize_path(mydest) + os.sep myindex=myid[0] mydata=myid[1] - try: - origdir=os.getcwd() - except SystemExit as e: - raise - except: - os.chdir("/") - origdir="/" - os.chdir(mydest) myindexlen=len(myindex) startpos=0 while ((startpos+8)