Fixed possible buffer underflow.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni Uhlig
2023-11-20 15:30:28 +01:00
parent bb9f02719d
commit 830174c7b5
2 changed files with 3 additions and 3 deletions

View File

@@ -702,7 +702,7 @@ static inline int nDPIsrvd_setup_address(struct nDPIsrvd_address * const address
}
if (destination[0] == '[')
{
if (last_colon > destination && *(last_colon - 1) != ']')
if (last_colon - destination > 1 && *(last_colon - 1) != ']')
{
return 1;
}

View File

@@ -1516,8 +1516,8 @@ static int mainloop(struct nio * const io)
static int setup_event_queue(struct nio * const io)
{
#ifdef ENABLE_EPOLL
if ((nDPIsrvd_options.use_poll == 0 && nio_use_epoll(io, 32) != NIO_SUCCESS)
|| (nDPIsrvd_options.use_poll != 0 && nio_use_poll(io, nDPIsrvd_MAX_REMOTE_DESCRIPTORS) != NIO_SUCCESS))
if ((nDPIsrvd_options.use_poll == 0 && nio_use_epoll(io, 32) != NIO_SUCCESS) ||
(nDPIsrvd_options.use_poll != 0 && nio_use_poll(io, nDPIsrvd_MAX_REMOTE_DESCRIPTORS) != NIO_SUCCESS))
#else
if (nio_use_poll(io, nDPIsrvd_MAX_REMOTE_DESCRIPTORS) != NIO_SUCCESS)
#endif