diff options
-rw-r--r-- | source/pdf/pdf-object.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index 056d6a73..0c60c228 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -2130,10 +2130,9 @@ int pdf_print_encrypted_obj(fz_context *ctx, fz_output *out, pdf_obj *obj, int t char *ptr; int n; - n = pdf_sprint_obj(ctx, NULL, 0, obj, tight); - if ((n + 1) < sizeof buf) + n = pdf_sprint_encrypted_obj(ctx, buf, sizeof buf, obj, tight, crypt, num, gen); + if (n <= sizeof buf) { - pdf_sprint_encrypted_obj(ctx, buf, sizeof buf, obj, tight, crypt, num, gen); fz_write_data(ctx, out, buf, n); } else |