X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbio%2Fbf_buff.c;h=c1fd75aaad80f071c0f2fce330c08d95b6bd4ddd;hp=f50e8f98a3dababc89e12c63de8ddb8a4b83f770;hb=606c8048a08d424663ff69045ba3f657a3e38d72;hpb=affadbef0b88dac4c33d5ecdc0f431f2a3ffbec5 diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index f50e8f98a3..c1fd75aaad 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -60,7 +60,6 @@ #include #include "cryptlib.h" #include -#include static int buffer_write(BIO *h, const char *buf,int num); static int buffer_read(BIO *h, char *buf, int size); @@ -70,7 +69,7 @@ static long buffer_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int buffer_new(BIO *h); static int buffer_free(BIO *data); static long buffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); -#define DEFAULT_BUFFER_SIZE 1024 +#define DEFAULT_BUFFER_SIZE 4096 static BIO_METHOD methods_buffer= { @@ -483,7 +482,7 @@ static int buffer_gets(BIO *b, char *buf, int size) size-=i; ctx->ibuf_len-=i; ctx->ibuf_off+=i; - if ((flag) || (i == size)) + if (flag || size == 0) { *buf='\0'; return(num); @@ -495,6 +494,7 @@ static int buffer_gets(BIO *b, char *buf, int size) if (i <= 0) { BIO_copy_next_retry(b); + *buf='\0'; if (i < 0) return((num > 0)?num:i); if (i == 0) return(num); }