Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Include space for alignment in read buffer resize check
Browse files Browse the repository at this point in the history
Change-Id: I0c7e2612b9b79cdd49096144aad5f0009bcb3857
http://code.google.com/p/android/issues/detail?id=15356
Bug: 4074737
  • Loading branch information
bdcgoogle committed Mar 10, 2011
1 parent 1537fcb commit f07bf9f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion patches/small_records.patch
Expand Up @@ -157,7 +157,7 @@
+ /* If we receive a valid record larger than the current buffer size,
+ * allocate some memory for it.
+ */
+ if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH)
+ if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH - align)
+ {
+ if ((p=OPENSSL_realloc(s->s3->rbuf.buf, rr->length + SSL3_RT_HEADER_LENGTH + align))==NULL)
+ {
Expand Down
2 changes: 1 addition & 1 deletion ssl/s3_pkt.c
Expand Up @@ -359,7 +359,7 @@ fprintf(stderr, "Record type=%d, Length=%d\n", rr->type, rr->length);
/* If we receive a valid record larger than the current buffer size,
* allocate some memory for it.
*/
if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH)
if (rr->length > s->s3->rbuf.len - SSL3_RT_HEADER_LENGTH - align)
{
if ((p=OPENSSL_realloc(s->s3->rbuf.buf, rr->length + SSL3_RT_HEADER_LENGTH + align))==NULL)
{
Expand Down

0 comments on commit f07bf9f

Please sign in to comment.