[entropy.tools] dump_entropy_metadata(): check if file is empty before using mmap()

This commit is contained in:
Fabio Erculiani
2011-08-08 18:14:41 +02:00
parent 2a186df4e6
commit ddd289f766

View File

@@ -1391,6 +1391,9 @@ def dump_entropy_metadata(entropy_package_file, entropy_metadata_file):
old_mmap = None
try:
f_size = os.lstat(entropy_package_file).st_size
if f_size <= 0:
# WTF!
return False
# avoid security flaw caused by file size growing race condition
# we conside the file size static
if f_size < mmap_size_th: