Closed fish98 closed 1 month ago
OK, so "string" is a temporary buffer. We copy N bytes to string, then nul-terminate the N+1'th byte in the buffer, and then make a copy as needed in the string pool. At no point do we look at byte N+2, N+3, etc., and bytes 0 to N+1 are initialized by the memcpy and assignment.
So honestly I don't see how this has any chance of leaking any information from "string".
Description
After the upgrade of
ipp.c
in the recent commit, the usage of uninitialized memory of the listarray
still exists in the functionipp_read_io
ofcups/ipp.c
. Detailed code can be found below:The
string
array is used to store temporal data from the buffer. Before the execution ofmemcpy(string, bufptr + 2, (size_t)n);
, there lacks proper initialization to ensure that the remaining parts of thestring
array are properly initialized. If the lengthn
is less thanIPP_MAX_TEXT
and less than the size of the array, the remaining parts will retain the original data in memory, which could lead to potential leaks or unexpected behavior.Suggested Fix
Add
memset(string, 0, sizeof(string));
Postscript
The related OSS-Fuzz issue.