summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2006-05-30 00:26:01 (GMT)
committerBob Ippolito <bob@redivi.com>2006-05-30 00:26:01 (GMT)
commit6067f20172842775933b4089ebdf9cbcdd4deb7c (patch)
treea886dcde28d5c7abd3cb7067a3fddd979629a22b /Lib
parent2fd3977a9da2675ad5ee693f8c88300e9c6bb0ee (diff)
downloadcpython-6067f20172842775933b4089ebdf9cbcdd4deb7c.zip
cpython-6067f20172842775933b4089ebdf9cbcdd4deb7c.tar.gz
cpython-6067f20172842775933b4089ebdf9cbcdd4deb7c.tar.bz2
Add a length check to aifc to ensure it doesn't write a bogus file
Diffstat (limited to 'Lib')
-rw-r--r--Lib/aifc.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 781d77c..a5f86be 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: