dnpds40: Max printjob size was too small.

Resulted in 8x12 @600dpi prints failing to fully parse due to buffer overflows.

Also added a log message when we fail to read things.
This commit is contained in:
Solomon Peachy 2015-06-23 19:40:35 -04:00
parent 19ce36f65b
commit 980fada366
1 changed files with 4 additions and 2 deletions

View File

@ -448,7 +448,7 @@ static void dnpds40_teardown(void *vctx) {
free(ctx);
}
#define MAX_PRINTJOB_LEN (((2448*7536+1024+54))*3+1024) /* Worst-case */
#define MAX_PRINTJOB_LEN (((2560*7536+1024+54))*3+1024) /* Worst-case */
static int dnpds40_read_parse(void *vctx, int data_fd) {
struct dnpds40_ctx *ctx = vctx;
@ -515,8 +515,10 @@ static int dnpds40_read_parse(void *vctx, int data_fd) {
while (remain > 0) {
i = read(data_fd, ctx->databuf + ctx->datalen + sizeof(struct dnpds40_cmd),
remain);
if (i < 0)
if (i < 0) {
ERROR("Data Read Error: %d (%d/%d @%d)\n", i, remain, j, ctx->datalen);
return i;
}
if (i == 0)
return 1;
ctx->datalen += i;