From 7a19d8991c492b654797b6629c7d8e5316e91630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Fri, 12 Dec 2014 15:46:23 +0100 Subject: make xps_read_part report correct part sizes Starting with commit 2f4cdd4fd0580e3121773e89a7c6e7a9e1ffa54b, xps_read_part zero-terminates the read data. It does however also count that zero-terminator to the part's size which confuses callers handling non-text data. --- source/xps/xps-zip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c index 4f524752..8b96773f 100644 --- a/source/xps/xps-zip.c +++ b/source/xps/xps-zip.c @@ -96,7 +96,8 @@ xps_read_part(xps_document *doc, char *partname) /* take over the data */ data = buf->data; - size = buf->len; + /* size doesn't include the added zero-terminator */ + size = buf->len - 1; fz_free(ctx, buf); return xps_new_part(doc, partname, data, size); -- cgit v1.2.3