]> git.ipfire.org Git - thirdparty/openssl.git/commit
Avoid potential double close of client_skt in sslecho
authorLevi Zim <rsworktech@outlook.com>
Wed, 16 Apr 2025 06:21:33 +0000 (14:21 +0800)
committerMatt Caswell <matt@openssl.org>
Fri, 20 Jun 2025 14:44:29 +0000 (15:44 +0100)
commit48e3fe08639d84bd557c0d5248f5600f2fb1f7de
treeec011753636e009ac222f2047562f47c109d707d
parent03839dc6ef6776404e0f60be0924bd883aaf9ca9
Avoid potential double close of client_skt in sslecho

The server_running variable is declared as volatile and some comments in
the code are mentioning about implementing CTRL+C handler in the future.

In the client handling loop, the client_skt is closed at the end of the
loop if server_running is true. If (future) CTRL+C handler changes
server_running to false at this time. The next accept will not happen
and the exit clean up code will close client_skt for the second time.

This patch fixes this potential double close by setting client_skt back
to -1 after closing it.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27405)
demos/sslecho/main.c