tls BIOs: handle BIO_CTRL_EOF correctly

Needs to return 1 if EOF from underlying filter has been seen.

Fixes #17471
Reported-by: Michael Kaufmann
Closes #17526
This commit is contained in:
Stefan Eissing 2025-06-03 11:54:40 +02:00 committed by Daniel Stenberg
parent c7658f274c
commit f1e1c8b98a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 8 additions and 4 deletions

View file

@ -698,9 +698,11 @@ static long ossl_bio_cf_ctrl(BIO *bio, int cmd, long num, void *ptr)
ret = 1;
break;
#ifdef BIO_CTRL_EOF
case BIO_CTRL_EOF:
case BIO_CTRL_EOF: {
/* EOF has been reached on input? */
return !cf->next || !cf->next->connected;
struct ssl_connect_data *connssl = cf->ctx;
return connssl->peer_closed;
}
#endif
default:
ret = 0;

View file

@ -299,9 +299,11 @@ static long wssl_bio_cf_ctrl(WOLFSSL_BIO *bio, int cmd, long num, void *ptr)
ret = 1;
break;
#ifdef WOLFSSL_BIO_CTRL_EOF
case WOLFSSL_BIO_CTRL_EOF:
case WOLFSSL_BIO_CTRL_EOF: {
/* EOF has been reached on input? */
return !cf->next || !cf->next->connected;
struct ssl_connect_data *connssl = cf->ctx;
return connssl->peer_closed;
}
#endif
default:
ret = 0;