1
0
Fork 0
mirror of https://github.com/klezVirus/CVE-2021-40444.git synced 2024-11-21 21:10:47 +00:00

Added filename length too long check

This commit is contained in:
d3adc0de 2021-09-16 08:40:10 +01:00
parent 701acf48f9
commit 835b3db336

View file

@ -193,6 +193,8 @@ def validate_filename(filename):
if not filename: if not filename:
filename = "" filename = ""
current_length = len(filename) current_length = len(filename)
if current_length > 12:
filename = filename[:12]
gap = required_length - current_length gap = required_length - current_length
return filename + ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(gap)) return filename + ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(gap))