aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf.c
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2020-12-31 18:58:52 +0000
committeryzrh <yzrh@noema.org>2020-12-31 20:38:02 +0000
commitb20c6ad3ed930977990f3812b25b80d2ce282d79 (patch)
tree26b96fce5d8765b2dd07aec40a286b44a0c93dce /src/pdf.c
parent3bd7ea7520e13f5fabcfadb1a7630398bc1dca6d (diff)
downloadmelon-b20c6ad3ed930977990f3812b25b80d2ce282d79.tar.gz
melon-b20c6ad3ed930977990f3812b25b80d2ce282d79.tar.zst
Handle binary data in dictionary.
Diffstat (limited to 'src/pdf.c')
-rw-r--r--src/pdf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pdf.c b/src/pdf.c
index efcf730..202b6d2 100644
--- a/src/pdf.c
+++ b/src/pdf.c
@@ -84,24 +84,24 @@ pdf_obj_add(pdf_object_t **pdf, int id,
(*pdf)->id = id;
if (dictionary != NULL) {
- (*pdf)->dictionary_size = strlen(dictionary) + 1;
+ (*pdf)->dictionary_size = strlen(dictionary);
(*pdf)->dictionary = malloc((*pdf)->dictionary_size);
if ((*pdf)->dictionary == NULL)
return 1;
- strncpy((*pdf)->dictionary, dictionary, (*pdf)->dictionary_size);
+ memcpy((*pdf)->dictionary, dictionary, (*pdf)->dictionary_size);
(*pdf)->object_size = 0;
(*pdf)->object = NULL;
} else if (object != NULL) {
- (*pdf)->object_size = strlen(object) + 1;
+ (*pdf)->object_size = strlen(object);
(*pdf)->object = malloc((*pdf)->object_size);
if ((*pdf)->object == NULL)
return 1;
- strncpy((*pdf)->object, object, (*pdf)->object_size);
+ memcpy((*pdf)->object, object, (*pdf)->object_size);
(*pdf)->dictionary_size = 0;
(*pdf)->dictionary = NULL;