diff --git a/src/parser_lyb.c b/src/parser_lyb.c index 252bf77..e5bc860 100644 --- a/src/parser_lyb.c +++ b/src/parser_lyb.c @@ -160,6 +160,9 @@ lyb_read_string(const char *data, char **str, int with_length, struct lyb_state } } + LY_CHECK_ERR_RETURN(len + 1 == 0, + LOGERR(lybs->ctx, LY_EINVAL, "LYB value size overflow."), LY_EINVAL); + *str = malloc((len + 1) * sizeof **str); LY_CHECK_ERR_RETURN(!*str, LOGMEM(lybs->ctx), -1);