diff options
| author | Ian Moffett <ian@osmora.org> | 2025-02-21 17:20:00 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-02-21 17:20:00 -0500 |
| commit | 405ecc29cc25152408f2abdc703de11d0c2ecfc7 (patch) | |
| tree | bf53486e2b5e4a008d035e60f63d46e1ae006759 /lib | |
| parent | 908a7c47131196470dbbe1719403e1bc1ea051f4 (diff) | |
server: listener: Prevent integer underflow
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libostp/server.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libostp/server.c b/lib/libostp/server.c index 5fa7045..794eda0 100644 --- a/lib/libostp/server.c +++ b/lib/libostp/server.c @@ -266,6 +266,10 @@ listener_cleanup(struct ostp_listener *lp) void listener_close(struct ostp_listener *lp, struct ostp_client *c) { + if (lp->client_count == 0) { + return; + } + close(c->sockfd); c->sockfd = -1; memset(&c->session, 0, sizeof(c->session)); |
