Commit 6ae4f5e0 authored by Matt Caswell's avatar Matt Caswell
Browse files

Simplify the overflow checks in WPACKET_allocate_bytes()



Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent 9bf85bf9
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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) {