fe449cd
diff -up openssl-1.1.0c/crypto/bio/bss_fd.c.preserve-nl openssl-1.1.0c/crypto/bio/bss_fd.c
fe449cd
--- openssl-1.1.0c/crypto/bio/bss_fd.c.preserve-nl	2016-11-10 15:03:44.000000000 +0100
fe449cd
+++ openssl-1.1.0c/crypto/bio/bss_fd.c	2016-12-22 14:36:16.730740423 +0100
fe449cd
@@ -202,8 +202,10 @@ static int fd_gets(BIO *bp, char *buf, i
fe449cd
     char *ptr = buf;
fe449cd
     char *end = buf + size - 1;
fe449cd
 
fe449cd
-    while ((ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n'))
fe449cd
-        ptr++;
fe449cd
+    while (ptr < end && fd_read(bp, ptr, 1) > 0) {
fe449cd
+        if (*ptr++ == '\n')
fe449cd
+           break;
fe449cd
+    }
fe449cd
 
fe449cd
     ptr[0] = '\0';
fe449cd
 
fe449cd
diff -up openssl-1.1.0c/doc/crypto/BIO_read.pod.preserve-nl openssl-1.1.0c/doc/crypto/BIO_read.pod
fe449cd
--- openssl-1.1.0c/doc/crypto/BIO_read.pod.preserve-nl	2016-11-10 15:03:45.000000000 +0100
fe449cd
+++ openssl-1.1.0c/doc/crypto/BIO_read.pod	2016-12-22 14:37:22.731245197 +0100
fe449cd
@@ -23,7 +23,8 @@ in B<buf>. Usually this operation will a
fe449cd
 from the BIO of maximum length B<len-1>. There are exceptions to this,
fe449cd
 however; for example, BIO_gets() on a digest BIO will calculate and
fe449cd
 return the digest and other BIOs may not support BIO_gets() at all.
fe449cd
-The returned string is always NUL-terminated.
fe449cd
+The returned string is always NUL-terminated and the '\n' is preserved
fe449cd
+if present in the input data.
fe449cd
 
fe449cd
 BIO_write() attempts to write B<len> bytes from B<buf> to BIO B.
fe449cd