summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/b_print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/b_print.c')
-rw-r--r--src/lib/libcrypto/bio/b_print.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c
index b7e268f092..3ce1290772 100644
--- a/src/lib/libcrypto/bio/b_print.c
+++ b/src/lib/libcrypto/bio/b_print.c
@@ -56,6 +56,13 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59/* disable assert() unless BIO_DEBUG has been defined */
60#ifndef BIO_DEBUG
61# ifndef NDEBUG
62# define NDEBUG
63# endif
64#endif
65
59/* 66/*
60 * Stolen from tjh's ssl/ssl_trc.c stuff. 67 * Stolen from tjh's ssl/ssl_trc.c stuff.
61 */ 68 */
@@ -716,12 +723,13 @@ doapr_outch(
716 if (buffer) { 723 if (buffer) {
717 while (*currlen >= *maxlen) { 724 while (*currlen >= *maxlen) {
718 if (*buffer == NULL) { 725 if (*buffer == NULL) {
719 assert(*sbuffer != NULL);
720 if (*maxlen == 0) 726 if (*maxlen == 0)
721 *maxlen = 1024; 727 *maxlen = 1024;
722 *buffer = OPENSSL_malloc(*maxlen); 728 *buffer = OPENSSL_malloc(*maxlen);
723 if (*currlen > 0) 729 if (*currlen > 0) {
730 assert(*sbuffer != NULL);
724 memcpy(*buffer, *sbuffer, *currlen); 731 memcpy(*buffer, *sbuffer, *currlen);
732 }
725 *sbuffer = NULL; 733 *sbuffer = NULL;
726 } else { 734 } else {
727 *maxlen += 1024; 735 *maxlen += 1024;
@@ -761,7 +769,9 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args)
761 { 769 {
762 int ret; 770 int ret;
763 size_t retlen; 771 size_t retlen;
764 MS_STATIC char hugebuf[1024*10]; 772 char hugebuf[1024*2]; /* Was previously 10k, which is unreasonable
773 in small-stack environments, like threads
774 or DOS programs. */
765 char *hugebufp = hugebuf; 775 char *hugebufp = hugebuf;
766 size_t hugebufsize = sizeof(hugebuf); 776 size_t hugebufsize = sizeof(hugebuf);
767 char *dynbuf = NULL; 777 char *dynbuf = NULL;