summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2016-11-15 10:10:32 +0100
committerRichard Levitte <levitte@openssl.org>2017-05-15 15:13:36 +0200
commit79b35228f1cc6fea47bab34611d79aab190f4f28 (patch)
tree8650654d065bb2877bf6d224dd7975651185266e /crypto/bio
parentINSTALL: Remind people to read more if they added configuration options (diff)
downloadopenssl-79b35228f1cc6fea47bab34611d79aab190f4f28.tar.xz
openssl-79b35228f1cc6fea47bab34611d79aab190f4f28.zip
Do not eat trailing '\n' in BIO_gets for fd BIO.
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3442)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bss_fd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/bio/bss_fd.c b/crypto/bio/bss_fd.c
index 49976e7f80..2a9a0422a2 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';