s_server: correctly handle 2^14 byte long records
authorHubert Kario <hkario@redhat.com>
Mon, 17 Jan 2022 19:55:04 +0000 (20:55 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 20 Jan 2022 10:12:21 +0000 (11:12 +0100)
commit148b592db7ea18e0209078fe313514fb7c7553f5
tree91b19a313bd239875c03655162ae7a78f9210497
parenta822a0cb3c8466adbcee510a6234c0fe95ff4bfe
s_server: correctly handle 2^14 byte long records

as the code uses BIO_gets, and it always null terminates the
strings it reads, when it reads a record 2^14 byte long, it actually
returns 2^14-1 bytes to the calling application, in general it returns
size-1 bytes to the caller

This makes the code sub-optimal (as every 2^14 record will need two
BIO_gets() calls) and makes it impossible to use -rev option to test
all plaintext lengths (like in openssl#15706)

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17538)
apps/s_server.c