libyang/SOURCES/libyang-fix-CVE-2026-44673.patch
2026-06-08 14:31:01 -04:00

15 lines
467 B
Diff

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);