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)
This commit is contained in:
Tomas Mraz 2016-11-15 10:10:32 +01:00 committed by Richard Levitte
parent 62f218cb8d
commit 79b35228f1

View file

@ -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';