Skip to content

Commit 613a76f

Browse files
committed
xplist: Fix possible integer overflow
Thanks to @ylwango613 for reporting
1 parent 2bcc195 commit 613a76f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/xplist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
10661066
ctx->err++;
10671067
goto err_out;
10681068
}
1069-
int taglen = ctx->pos - p;
1069+
size_t taglen = ctx->pos - p;
10701070
tag = (char*)malloc(taglen + 1);
10711071
strncpy(tag, p, taglen);
10721072
tag[taglen] = '\0';
@@ -1084,7 +1084,7 @@ static plist_err_t node_from_xml(parse_ctx ctx, plist_t *plist)
10841084
goto err_out;
10851085
}
10861086
if (*(ctx->pos-1) == '/') {
1087-
int idx = ctx->pos - p - 1;
1087+
size_t idx = ctx->pos - p - 1;
10881088
if (idx < taglen)
10891089
tag[idx] = '\0';
10901090
is_empty = 1;

0 commit comments

Comments
 (0)