Add a length check to aifc to ensure it doesn't write a bogus file

This commit is contained in:
Bob Ippolito 2006-05-30 00:26:01 +00:00
parent 2fd3977a9d
commit 6067f20172
1 changed files with 2 additions and 0 deletions

View File

@ -201,6 +201,8 @@ def _write_long(f, x):
f.write(struct.pack('>L', x))
def _write_string(f, s):
if len(s) > 255:
raise ValueError("string exceeds maximum pstring length")
f.write(chr(len(s)))
f.write(s)
if len(s) & 1 == 0: