mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Add a length check to aifc to ensure it doesn't write a bogus file
This commit is contained in:
parent
2fd3977a9d
commit
6067f20172
1 changed files with 2 additions and 0 deletions
|
@ -201,6 +201,8 @@ def _write_long(f, x):
|
||||||
f.write(struct.pack('>L', x))
|
f.write(struct.pack('>L', x))
|
||||||
|
|
||||||
def _write_string(f, s):
|
def _write_string(f, s):
|
||||||
|
if len(s) > 255:
|
||||||
|
raise ValueError("string exceeds maximum pstring length")
|
||||||
f.write(chr(len(s)))
|
f.write(chr(len(s)))
|
||||||
f.write(s)
|
f.write(s)
|
||||||
if len(s) & 1 == 0:
|
if len(s) & 1 == 0:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue