]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
patch [ 1300515 ] xdrlib.py: pack_fstring() did not use null bytes for padding
authorGeorg Brandl <georg@python.org>
Thu, 29 Sep 2005 20:49:16 +0000 (20:49 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 29 Sep 2005 20:49:16 +0000 (20:49 +0000)
Lib/xdrlib.py
Misc/NEWS

index d9d2120a60c1156e47f99e8b4cdb21c603f7d801..47cc22b2e6ca9f2a3bdbc228feff0a9fda00d72a 100644 (file)
@@ -79,8 +79,8 @@ class Packer:
     def pack_fstring(self, n, s):
         if n < 0:
             raise ValueError, 'fstring size must be nonnegative'
-        n = ((n+3)/4)*4
         data = s[:n]
+        n = ((n+3)/4)*4
         data = data + (n - len(data)) * '\0'
         self.__buf.write(data)
 
index ec70b951e64213bf4d14a51fa370ad09b35eafdd..3c06f4ecf8dd771c779691418be91996c0b0b9b4 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -242,6 +242,9 @@ Extension Modules
 Library
 -------
 
+- Patch #1300515: xdrlib.py: Fix pack_fstring() to really use null bytes
+  for padding.
+
 - Bug #1296004: httplib.py: Limit maximal amount of data read from the
   socket to avoid a MemoryError on Windows.