Fill pad bytes with zeros (fixing a bug dating from the very first version!).
This commit is contained in:
parent
dbadd558b5
commit
b9d338cbfb
@ -1148,7 +1148,7 @@ struct_pack(self, args)
|
|||||||
char *fmt;
|
char *fmt;
|
||||||
int size, num;
|
int size, num;
|
||||||
int i, n;
|
int i, n;
|
||||||
char *s, *res, *restart;
|
char *s, *res, *restart, *nres;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (args == NULL || !PyTuple_Check(args) ||
|
if (args == NULL || !PyTuple_Check(args) ||
|
||||||
@ -1186,7 +1186,10 @@ struct_pack(self, args)
|
|||||||
e = getentry(c, f);
|
e = getentry(c, f);
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
goto fail;
|
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')
|
if (num == 0 && c != 's')
|
||||||
continue;
|
continue;
|
||||||
do {
|
do {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user