From: Richard Levitte Date: Wed, 11 Jun 2003 18:43:47 +0000 (+0000) Subject: Make sure to NUL-terminate the string on end-of-file (and error) X-Git-Tag: OpenSSL_0_9_6k~27 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c2edb62beb90a11ebcdfc93e6110f8acdb4c5de9;p=oweals%2Fopenssl.git Make sure to NUL-terminate the string on end-of-file (and error) PR: 643 --- diff --git a/crypto/bio/bf_buff.c b/crypto/bio/bf_buff.c index c90238bae1..3226f5faf9 100644 --- a/crypto/bio/bf_buff.c +++ b/crypto/bio/bf_buff.c @@ -169,6 +169,7 @@ start: if (i <= 0) { BIO_copy_next_retry(b); + *buf='\0'; if (i < 0) return((num > 0)?num:i); if (i == 0) return(num); } @@ -495,6 +496,9 @@ static int buffer_gets(BIO *b, char *buf, int size) if (i <= 0) { BIO_copy_next_retry(b); + *buf='\0'; + fprintf(stderr, "DEBUG[buffer_gets]: i = %d\n", + i); if (i < 0) return((num > 0)?num:i); if (i == 0) return(num); }