diff options
author | yzrh <yzrh@noema.org> | 2020-12-31 18:58:52 +0000 |
---|---|---|
committer | yzrh <yzrh@noema.org> | 2020-12-31 20:38:02 +0000 |
commit | b20c6ad3ed930977990f3812b25b80d2ce282d79 (patch) | |
tree | 26b96fce5d8765b2dd07aec40a286b44a0c93dce /src/pdf.c | |
parent | 3bd7ea7520e13f5fabcfadb1a7630398bc1dca6d (diff) | |
download | melon-b20c6ad3ed930977990f3812b25b80d2ce282d79.tar.gz melon-b20c6ad3ed930977990f3812b25b80d2ce282d79.tar.zst |
Handle binary data in dictionary.
Diffstat (limited to 'src/pdf.c')
-rw-r--r-- | src/pdf.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; |