From 980fada3668dcbb4da624a038007d03a5490d6ec Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 23 Jun 2015 19:40:35 -0400 Subject: [PATCH] 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. --- backend_dnpds40.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend_dnpds40.c b/backend_dnpds40.c index 8cc0916..90e642f 100644 --- a/backend_dnpds40.c +++ b/backend_dnpds40.c @@ -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;