summaryrefslogtreecommitdiffstats
path: root/src/xplist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-01-22 13:12:45 +0100
committerGravatar Nikias Bassen2026-01-22 13:12:45 +0100
commit2b5b43bdb301eeb7e3396833af25212aeb09214f (patch)
tree202d133088fea0603af607f7ccc116e192c39481 /src/xplist.c
parentac7b64160f5c204b11451cdda0165e0a1a810188 (diff)
downloadlibplist-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.c6
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
979 tp = tmp; 979 tp = tmp;
980 while (tp && tp->begin) { 980 while (tp && tp->begin) {
981 size_t len = tp->length; 981 size_t len = tp->length;
982 strncpy(p, tp->begin, len); 982 memcpy(p, tp->begin, len);
983 p[len] = '\0'; 983 p[len] = '\0';
984 if (!tp->is_cdata && unesc_entities) { 984 if (!tp->is_cdata && unesc_entities) {
985 if (unescape_entities(p, &len) < 0) { 985 if (unescape_entities(p, &len) < 0) {
@@ -1110,7 +1110,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
1110 } 1110 }
1111 size_t taglen = ctx->pos - p; 1111 size_t taglen = ctx->pos - p;
1112 tag = (char*)malloc(taglen + 1); 1112 tag = (char*)malloc(taglen + 1);
1113 strncpy(tag, p, taglen); 1113 memcpy(tag, p, taglen);
1114 tag[taglen] = '\0'; 1114 tag[taglen] = '\0';
1115 if (*ctx->pos != '>') { 1115 if (*ctx->pos != '>') {
1116 find_next(ctx, "<>", 2, 1); 1116 find_next(ctx, "<>", 2, 1);
@@ -1386,7 +1386,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
1386 /* we need to copy here and 0-terminate because sscanf will read the entire string (whole rest of XML data) which can be huge */ 1386 /* we need to copy here and 0-terminate because sscanf will read the entire string (whole rest of XML data) which can be huge */
1387 char strval[32]; 1387 char strval[32];
1388 struct TM btime; 1388 struct TM btime;
1389 strncpy(strval, str_content, length); 1389 memcpy(strval, str_content, length);
1390 strval[tp->length] = '\0'; 1390 strval[tp->length] = '\0';
1391 parse_date(strval, &btime); 1391 parse_date(strval, &btime);
1392 timev = timegm64(&btime); 1392 timev = timegm64(&btime);