Mercurial > cpython-lru_cache-weakref
diff Modules/structmodule.c @ 4867:e3f2ab0b0aa1 legacy-trunk
Fill pad bytes with zeros (fixing a bug dating from the very first version!).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 03 Jan 1997 15:40:33 +0000 |
| parents | f5073e24147c |
| children | 03bcdd22f6a4 |
line wrap: on
line diff
--- a/Modules/structmodule.c Fri Jan 03 04:20:09 1997 +0000 +++ b/Modules/structmodule.c Fri Jan 03 15:40:33 1997 +0000 @@ -1148,7 +1148,7 @@ char *fmt; int size, num; int i, n; - char *s, *res, *restart; + char *s, *res, *restart, *nres; char c; if (args == NULL || !PyTuple_Check(args) || @@ -1186,7 +1186,10 @@ e = getentry(c, f); if (e == NULL) goto fail; - res = restart + align((int)(res-restart), c, e); + nres = restart + align((int)(res-restart), c, e); + /* Fill padd bytes with zeros */ + while (res < nres) + *res++ = '\0'; if (num == 0 && c != 's') continue; do {
