summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-01-21 17:33:53 +0100
committerGravatar Nikias Bassen2026-01-21 17:33:53 +0100
commitf06c4c6b6cf29c9e53637731fedd86a6e99e9882 (patch)
tree9cafd3b51d0d194f265df12be2f9e50e4ac8c25e /src
parentc0f9df912d2a4001e56321fb53615e6474b32232 (diff)
downloadlibplist-f06c4c6b6cf29c9e53637731fedd86a6e99e9882.tar.gz
libplist-f06c4c6b6cf29c9e53637731fedd86a6e99e9882.tar.bz2
plist: Fix incorrect size storage in plist_copy() for PLIST_STRING nodes
Diffstat (limited to 'src')
-rw-r--r--src/plist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plist.c b/src/plist.c
index 6197e3d..1eaa4e6 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -593,10 +593,10 @@ static plist_t plist_copy_node(node_t node)
593 case PLIST_KEY: 593 case PLIST_KEY:
594 case PLIST_STRING: 594 case PLIST_STRING:
595 if (data->strval) { 595 if (data->strval) {
596 size_t n = strlen(data->strval) + 1; 596 size_t n = strlen(data->strval);
597 newdata->strval = (char*)malloc(n); 597 newdata->strval = (char*)malloc(n+1);
598 assert(newdata->strval); 598 assert(newdata->strval);
599 memcpy(newdata->strval, data->strval, n); 599 memcpy(newdata->strval, data->strval, n+1);
600 newdata->length = (uint64_t)n; 600 newdata->length = (uint64_t)n;
601 } else { 601 } else {
602 newdata->strval = NULL; 602 newdata->strval = NULL;