summaryrefslogtreecommitdiffstats
path: root/crypto/bio/bss_fd.c
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/bss_fd.c
parent62f218cb8d31851935b8113a2a2236493b3510cc (diff)
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/bss_fd.c')
-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';