提交 6ae4f5e0 编写于 作者: M Matt Caswell

Simplify the overflow checks in WPACKET_allocate_bytes()

Reviewed-by: NRich Salz <rsalz@openssl.org>
上级 9bf85bf9
......@@ -16,10 +16,7 @@ int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
if (pkt->subs == NULL || len == 0)
return 0;
if (SIZE_MAX - pkt->written < len)
return 0;
if (pkt->written + len > pkt->maxsize)
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册