projects
/
openssl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9bf85bf
)
Simplify the overflow checks in WPACKET_allocate_bytes()
author
Matt Caswell
<matt@openssl.org>
Thu, 8 Sep 2016 22:08:53 +0000
(23:08 +0100)
committer
Matt Caswell
<matt@openssl.org>
Tue, 13 Sep 2016 08:41:21 +0000
(09:41 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
ssl/packet.c
patch
|
blob
|
history
diff --git
a/ssl/packet.c
b/ssl/packet.c
index 4823b16a6e3157b8dbda5b9cecb06d38570699db..e75193ddc3202bb6afbc7a3e0f10d81dcbe7e8db 100644
(file)
--- 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 (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) {
return 0;
if (pkt->buf->length - pkt->written < len) {