summaryrefslogtreecommitdiff
path: root/source/fitz/output.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-01-04 12:17:39 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-01-05 14:47:37 +0100
commitef4897ce4c3c497179ff666745a75349600bf5f6 (patch)
treef2bc36fcec9975afcebc45ce4956ff2c5b669160 /source/fitz/output.c
parentd5394cbcf3a98dcabc49264172d4ce6618535d91 (diff)
downloadmupdf-ef4897ce4c3c497179ff666745a75349600bf5f6.tar.xz
Clarify snprintf length when printing to fz_buffer and fz_output.
The +1's for zero terminating bytes are not needed: printf to a fz_buffer or fz_output does not write a zero terminator. The extra code to add space for a zero terminator when calling snprintf internally are merely confusing.
Diffstat (limited to 'source/fitz/output.c')
-rw-r--r--source/fitz/output.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/fitz/output.c b/source/fitz/output.c
index 1f713709..b3efb121 100644
--- a/source/fitz/output.c
+++ b/source/fitz/output.c
@@ -162,11 +162,11 @@ fz_vprintf(fz_context *ctx, fz_output *out, const char *fmt, va_list old_args)
va_copy_end(args);
/* If that failed, allocate a big enough buffer */
- if (len >= sizeof buffer)
+ if (len > sizeof buffer)
{
- p = fz_malloc(ctx, len + 1);
+ p = fz_malloc(ctx, len);
va_copy(args, old_args);
- fz_vsnprintf(p, len + 1, fmt, args);
+ fz_vsnprintf(p, len, fmt, args);
va_copy_end(args);
}