summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-31 23:25:37 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-31 23:25:37 +0000
commit59b77c7048c0095c08a2de66e97fb956b89853a7 (patch)
treef033a03b7398f47df2cbc5729f8b2c1cce3fefa1
parent3389688b4d1874a2f47c7de96537922ab280cb7d (diff)
downloadportage-59b77c7048c0095c08a2de66e97fb956b89853a7.tar.gz
portage-59b77c7048c0095c08a2de66e97fb956b89853a7.tar.bz2
portage-59b77c7048c0095c08a2de66e97fb956b89853a7.zip
For bug #153295, make load_infodir ignore files that contain null bytes.
svn path=/main/trunk/; revision=4893
-rw-r--r--pym/portage.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index adb97c502..400d87b91 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -1497,11 +1497,17 @@ class config:
self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment"
myre = re.compile('^[A-Z]+$')
+ null_byte = "\0"
for filename in listdir(infodir,filesonly=1,EmptyOnError=1):
if myre.match(filename):
try:
- mydata = string.strip(open(infodir+"/"+filename).read())
+ file_path = os.path.join(infodir, filename)
+ mydata = open(file_path).read().strip()
if len(mydata) < 2048 or filename == "USE":
+ if null_byte in mydata:
+ writemsg("!!! Null byte found in metadata " + \
+ "file: '%s'\n" % file_path, noiselevel=-1)
+ continue
if filename == "USE":
binpkg_flags = "-* " + mydata
self.configdict["pkg"][filename] = binpkg_flags