Make sure to NUL-terminate the string on end-of-file (and error)
authorRichard Levitte <levitte@openssl.org>
Wed, 11 Jun 2003 18:43:45 +0000 (18:43 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 11 Jun 2003 18:43:45 +0000 (18:43 +0000)
PR: 643

crypto/bio/bf_buff.c

index 1cecd70579569f50b64a0e431ca5bf00358b74bd..c1fd75aaad80f071c0f2fce330c08d95b6bd4ddd 100644 (file)
@@ -494,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);
                                }