Use calloc to zero fill buffers being allocated for replies & events

Ensures padding bytes are zero-filled

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Alan Coopersmith
2012-07-09 19:12:42 -07:00
parent ef0f701c92
commit cdf5bcd420
9 changed files with 15 additions and 13 deletions

View File

@@ -531,7 +531,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
num = pFormat->index.nvalues;
rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
num * sizeof(xIndexValue));
reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
if (!reply)
return BadAlloc;
@@ -1688,7 +1688,7 @@ ProcRenderQueryFilters(ClientPtr client)
}
len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
if (!reply)
return BadAlloc;
aliases = (INT16 *) (reply + 1);