summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortedu <>2014-04-24 04:31:30 +0000
committertedu <>2014-04-24 04:31:30 +0000
commitf0a36b9f78febba27b10781ea27c65ab1f85e385 (patch)
tree5378359d8dd39e01cd2d55845cdfd643fea4389a /src/lib
parent329f166fa52c590ad4f531997654c913f07020cf (diff)
downloadopenbsd-f0a36b9f78febba27b10781ea27c65ab1f85e385.tar.gz
openbsd-f0a36b9f78febba27b10781ea27c65ab1f85e385.tar.bz2
openbsd-f0a36b9f78febba27b10781ea27c65ab1f85e385.zip
on today's episode of things you didn't want to learn:
do_ssl3_write() is recursive. and not in the simple, obvious way, but in the sneaky called through ssl3_dispatch_alert way. (alert level: fuchsia) this then has a decent chance of releasing the buffer that we thought we were going to use. check for this happening, and if the buffer has gone missing, put another one back in place. the direct recursive call is safe because it won't call ssl3_write_pending which is the function that actually does do the writing and releasing. as reported by David Ramos to openssl-dev: http://marc.info/?l=openssl-dev&m=139809493725682&w=2 ok beck
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libssl/s3_pkt.c4
-rw-r--r--src/lib/libssl/src/ssl/s3_pkt.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/libssl/s3_pkt.c b/src/lib/libssl/s3_pkt.c
index 60c51146ac..5ef25a4059 100644
--- a/src/lib/libssl/s3_pkt.c
+++ b/src/lib/libssl/s3_pkt.c
@@ -619,6 +619,10 @@ do_ssl3_write(SSL *s, int type, const unsigned char *buf,
619 if (i <= 0) 619 if (i <= 0)
620 return (i); 620 return (i);
621 /* if it went, fall through and send more stuff */ 621 /* if it went, fall through and send more stuff */
622 /* we may have released our buffer, so get it again */
623 if (wb->buf == NULL)
624 if (!ssl3_setup_write_buffer(s))
625 return -1;
622 } 626 }
623 627
624 if (len == 0 && !create_empty_fragment) 628 if (len == 0 && !create_empty_fragment)
diff --git a/src/lib/libssl/src/ssl/s3_pkt.c b/src/lib/libssl/src/ssl/s3_pkt.c
index 60c51146ac..5ef25a4059 100644
--- a/src/lib/libssl/src/ssl/s3_pkt.c
+++ b/src/lib/libssl/src/ssl/s3_pkt.c
@@ -619,6 +619,10 @@ do_ssl3_write(SSL *s, int type, const unsigned char *buf,
619 if (i <= 0) 619 if (i <= 0)
620 return (i); 620 return (i);
621 /* if it went, fall through and send more stuff */ 621 /* if it went, fall through and send more stuff */
622 /* we may have released our buffer, so get it again */
623 if (wb->buf == NULL)
624 if (!ssl3_setup_write_buffer(s))
625 return -1;
622 } 626 }
623 627
624 if (len == 0 && !create_empty_fragment) 628 if (len == 0 && !create_empty_fragment)