diff Modules/structmodule.c @ 19924:01f66f5db326 legacy-trunk

The 'p' (Pascal string) pack code acts unreasonably when the string size and count exceed 255. Changed to preserve as much of the string as possible (instead of count%256 characters).
author Tim Peters <tim.peters@gmail.com>
date Sat, 15 Sep 2001 02:35:15 +0000
parents 8df77415a61d
children edd9d0b3c47e
line wrap: on
line diff
--- a/Modules/structmodule.c	Fri Sep 14 23:17:55 2001 +0000
+++ b/Modules/structmodule.c	Sat Sep 15 02:35:15 2001 +0000
@@ -1360,6 +1360,8 @@
 				if (n < num)
 					/* no real need, just to be nice */
 					memset(res+1+n, '\0', num-n);
+				if (n > 255)
+					n = 255;
 				*res++ = n; /* store the length byte */
 				res += num;
 				break;