From: Bob Ippolito Date: Tue, 30 May 2006 00:26:01 +0000 (+0000) Subject: Add a length check to aifc to ensure it doesn't write a bogus file X-Git-Tag: v2.5b1~350 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6067f20172842775933b4089ebdf9cbcdd4deb7c;p=thirdparty%2FPython%2Fcpython.git Add a length check to aifc to ensure it doesn't write a bogus file --- diff --git a/Lib/aifc.py b/Lib/aifc.py index 781d77cee400..a5f86be455b5 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -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: