]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Extra asserts
authorTimo Sirainen <tss@iki.fi>
Fri, 23 May 2003 14:47:25 +0000 (17:47 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 23 May 2003 14:47:25 +0000 (17:47 +0300)
--HG--
branch : HEAD

src/lib/ioloop-poll.c

index 09a9b298fddfd70c6ef2131f3e535246a13fd467..32189a0409322f3c1cb66d2bbff83209f8ad14cf 100644 (file)
@@ -79,6 +79,8 @@ void io_loop_handle_add(struct ioloop *ioloop, int fd, int condition)
                old_size = data->idx_size;
 
                data->idx_size = nearest_power((unsigned int) fd+1);
+               i_assert(data->idx_size < (size_t)-1 / sizeof(int));
+
                data->fd_index = p_realloc(ioloop->pool, data->fd_index,
                                           sizeof(int) * old_size,
                                           sizeof(int) * data->idx_size);
@@ -91,6 +93,8 @@ void io_loop_handle_add(struct ioloop *ioloop, int fd, int condition)
                old_size = data->fds_size;
 
                data->fds_size = nearest_power(data->fds_size+1);
+               i_assert(data->fds_size < (size_t)-1 / sizeof(struct pollfd));
+
                data->fds = p_realloc(ioloop->pool, data->fds,
                                      sizeof(struct pollfd) * old_size,
                                      sizeof(struct pollfd) * data->fds_size);