diff options
| author | 2026-01-21 17:33:53 +0100 | |
|---|---|---|
| committer | 2026-01-21 17:33:53 +0100 | |
| commit | f06c4c6b6cf29c9e53637731fedd86a6e99e9882 (patch) | |
| tree | 9cafd3b51d0d194f265df12be2f9e50e4ac8c25e | |
| parent | c0f9df912d2a4001e56321fb53615e6474b32232 (diff) | |
| download | libplist-f06c4c6b6cf29c9e53637731fedd86a6e99e9882.tar.gz libplist-f06c4c6b6cf29c9e53637731fedd86a6e99e9882.tar.bz2 | |
plist: Fix incorrect size storage in plist_copy() for PLIST_STRING nodes
| -rw-r--r-- | src/plist.c | 6 |
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) case PLIST_KEY: case PLIST_STRING: if (data->strval) { - size_t n = strlen(data->strval) + 1; - newdata->strval = (char*)malloc(n); + size_t n = strlen(data->strval); + newdata->strval = (char*)malloc(n+1); assert(newdata->strval); - memcpy(newdata->strval, data->strval, n); + memcpy(newdata->strval, data->strval, n+1); newdata->length = (uint64_t)n; } else { newdata->strval = NULL; |
