From b20c6ad3ed930977990f3812b25b80d2ce282d79 Mon Sep 17 00:00:00 2001 From: yzrh Date: Thu, 31 Dec 2020 18:58:52 +0000 Subject: Handle binary data in dictionary. --- src/pdf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/pdf.c') 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; -- cgit v1.2.3