diff options
author | Simon Bünzli <zeniko@gmail.com> | 2014-12-12 15:46:23 +0100 |
---|---|---|
committer | Simon Bünzli <zeniko@gmail.com> | 2014-12-12 15:46:23 +0100 |
commit | 7a19d8991c492b654797b6629c7d8e5316e91630 (patch) | |
tree | 3c4796f66d894f6aea90428981b5e680bd76ea7a /source | |
parent | 6b5582e8206f2cdd3afeb4e32ebbe5d144334da7 (diff) | |
download | mupdf-7a19d8991c492b654797b6629c7d8e5316e91630.tar.xz |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/xps/xps-zip.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |