sony: Try to prevent malformed jobs from overflowing our buffer.

This commit is contained in:
Solomon Peachy 2019-03-22 08:37:43 -04:00
parent 644f3cd313
commit f7ed113b86

View file

@ -293,6 +293,13 @@ static int updr150_read_parse(void *vctx, const void **vjob, int data_fd, int co
if (keep)
job->datalen += sizeof(uint32_t);
/* Make sure we're not too large */
if (job->datalen + len > MAX_PRINTJOB_LEN) {
ERROR("Buffer overflow when parsing printjob! (%d+%d)\n",
job->datalen, len);
return CUPS_BACKEND_CANCEL;
}
/* Read in the data chunk */
while(len > 0) {
i = read(data_fd, job->databuf + job->datalen, len);