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:
parent
62f218cb8d
commit
79b35228f1
1 changed files with 4 additions and 2 deletions
|
@ -207,8 +207,10 @@ static int fd_gets(BIO *bp, char *buf, int size)
|
||||||
char *ptr = buf;
|
char *ptr = buf;
|
||||||
char *end = buf + size - 1;
|
char *end = buf + size - 1;
|
||||||
|
|
||||||
while ((ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n'))
|
while (ptr < end && fd_read(bp, ptr, 1) > 0) {
|
||||||
ptr++;
|
if (*ptr++ == '\n')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ptr[0] = '\0';
|
ptr[0] = '\0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue