Skip to content

Commit 73da1db

Browse files
committed
parser lyb BUGFIX avoid uint overflow
1 parent 979f692 commit 73da1db

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/parser_lyb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ lyb_read_string(char **str, struct lylyb_parse_ctx *lybctx)
285285
lyb_read_size(&str_len, lybctx);
286286

287287
/* allocate mem */
288-
*str = malloc((str_len + 1) * sizeof **str);
288+
*str = malloc(((uint64_t)str_len + 1) * sizeof **str);
289289
LY_CHECK_ERR_RET(!*str, LOGMEM(lybctx->ctx), LY_EMEM);
290290

291291
if (str_len) {
292292
/* read the string */
293-
lyb_read(*str, str_len * 8, lybctx);
293+
lyb_read(*str, (uint64_t)str_len * 8, lybctx);
294294
}
295295

296296
(*str)[str_len] = '\0';

0 commit comments

Comments
 (0)