summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-02-19 16:18:38 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-02-19 18:46:40 +0100
commit68169ec2511425d018c03a997f95ebfe043e41f9 (patch)
tree3c429e02ff9b816d09177b11491e6fbe3c253f95 /pdf
parent9cc9978a7260d201137459a65601e35dce1d444e (diff)
downloadmupdf-68169ec2511425d018c03a997f95ebfe043e41f9.tar.xz
Bug 693639: Use strlcpy instead of strncpy!
strncpy is *not* the correct function to use. It does not null terminate, and it needlessly zeroes past the end. It was designed for fixed length database records, not strings. Use fz_strlcpy and strlcat instead.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_xref.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index c94ad85e..7914876e 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -1301,8 +1301,7 @@ pdf_meta(pdf_document *doc, int key, void *ptr, int size)
if (info && ptr && size)
{
char *utf8 = pdf_to_utf8(doc, info);
- strncpy(ptr, utf8, size);
- ((char *)ptr)[size-1] = 0;
+ fz_strlcpy(ptr, utf8, size);
fz_free(doc->ctx, utf8);
}
return 1;