diff options
| author | 2026-01-22 13:12:45 +0100 | |
|---|---|---|
| committer | 2026-01-22 13:12:45 +0100 | |
| commit | 2b5b43bdb301eeb7e3396833af25212aeb09214f (patch) | |
| tree | 202d133088fea0603af607f7ccc116e192c39481 /src/xplist.c | |
| parent | ac7b64160f5c204b11451cdda0165e0a1a810188 (diff) | |
| download | libplist-2b5b43bdb301eeb7e3396833af25212aeb09214f.tar.gz libplist-2b5b43bdb301eeb7e3396833af25212aeb09214f.tar.bz2 | |
xplist: Use memcpy instead of strncpy since we know the exact size
Diffstat (limited to 'src/xplist.c')
| -rw-r--r-- | src/xplist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xplist.c b/src/xplist.c index 55b01e9..32e3f8b 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -979,7 +979,7 @@ static char* text_parts_get_content(text_part_t *tp, int unesc_entities, size_t tp = tmp; while (tp && tp->begin) { size_t len = tp->length; - strncpy(p, tp->begin, len); + memcpy(p, tp->begin, len); p[len] = '\0'; if (!tp->is_cdata && unesc_entities) { if (unescape_entities(p, &len) < 0) { @@ -1110,7 +1110,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist) } size_t taglen = ctx->pos - p; tag = (char*)malloc(taglen + 1); - strncpy(tag, p, taglen); + memcpy(tag, p, taglen); tag[taglen] = '\0'; if (*ctx->pos != '>') { find_next(ctx, "<>", 2, 1); @@ -1386,7 +1386,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist) /* we need to copy here and 0-terminate because sscanf will read the entire string (whole rest of XML data) which can be huge */ char strval[32]; struct TM btime; - strncpy(strval, str_content, length); + memcpy(strval, str_content, length); strval[tp->length] = '\0'; parse_date(strval, &btime); timev = timegm64(&btime); |
