diff options
author | Matt Caswell <matt@openssl.org> | 2016-09-08 23:08:53 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-09-13 09:41:21 +0100 |
commit | 6ae4f5e087d204e02a5dc88ea905cca9d144a30d (patch) | |
tree | c341895ade47180b15f3682d20c0cfa9aaa65309 | |
parent | 9bf85bf9c52359813b5f9f6709b381497671d625 (diff) |
Simplify the overflow checks in WPACKET_allocate_bytes()
Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r-- | ssl/packet.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/ssl/packet.c b/ssl/packet.c index 4823b16a6e..e75193ddc3 100644 --- a/ssl/packet.c +++ b/ssl/packet.c @@ -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) { |