[openssl-commits] [openssl] master update
Richard Levitte
levitte at openssl.org
Mon May 15 13:15:17 UTC 2017
The branch master has been updated
via 007d2725303936588df656042fd61aa8ec6f7254 (commit)
via bd4639bed67ddd28785899dc4ceef6b5b7fb44fd (commit)
via 79b35228f1cc6fea47bab34611d79aab190f4f28 (commit)
from 62f218cb8d31851935b8113a2a2236493b3510cc (commit)
- Log -----------------------------------------------------------------
commit 007d2725303936588df656042fd61aa8ec6f7254
Author: Tomas Mraz <tmraz at fedoraproject.org>
Date: Fri May 12 10:26:13 2017 +0200
Document the history of BIO_gets() on BIO_fd().
Reviewed-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3442)
commit bd4639bed67ddd28785899dc4ceef6b5b7fb44fd
Author: Tomas Mraz <tmraz at fedoraproject.org>
Date: Wed Nov 23 09:33:55 2016 +0100
Document that BIO_gets() preserves '\n'.
Reviewed-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3442)
commit 79b35228f1cc6fea47bab34611d79aab190f4f28
Author: Tomas Mraz <tmraz at fedoraproject.org>
Date: Tue Nov 15 10:10:32 2016 +0100
Do not eat trailing '\n' in BIO_gets for fd BIO.
Reviewed-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3442)
-----------------------------------------------------------------------
Summary of changes:
crypto/bio/bss_fd.c | 6 ++++--
doc/man3/BIO_read.pod | 8 +++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c
index 49976e7..2a9a042 100644
--- a/crypto/bio/bss_fd.c
+++ b/crypto/bio/bss_fd.c
@@ -207,8 +207,10 @@ static int fd_gets(BIO *bp, char *buf, int size)
char *ptr = buf;
char *end = buf + size - 1;
- while ((ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n'))
- ptr++;
+ while (ptr < end && fd_read(bp, ptr, 1) > 0) {
+ if (*ptr++ == '\n')
+ break;
+ }
ptr[0] = '\0';
diff --git a/doc/man3/BIO_read.pod b/doc/man3/BIO_read.pod
index bd9bb8f..270ab53 100644
--- a/doc/man3/BIO_read.pod
+++ b/doc/man3/BIO_read.pod
@@ -34,7 +34,8 @@ in B<buf>. Usually this operation will attempt to read a line of data
from the BIO of maximum length B<size-1>. There are exceptions to this,
however; for example, BIO_gets() on a digest BIO will calculate and
return the digest and other BIOs may not support BIO_gets() at all.
-The returned string is always NUL-terminated.
+The returned string is always NUL-terminated and the '\n' is preserved
+if present in the input data.
BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>.
@@ -79,6 +80,11 @@ to the chain.
L<BIO_should_retry(3)>
+=head1 HISTORY
+
+BIO_gets() on 1.1.0 and older when called on BIO_fd() based BIO does not
+keep the '\n' at the end of the line in the buffer.
+
=head1 COPYRIGHT
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
More information about the openssl-commits
mailing list