Project

General

Profile

Bug #269 ยป 0001-Buffer-Overflow-check-against-the-implicit-size-of-s.patch

Pierre-Louis Bonicoli, 2012-01-07 11:45

View differences:

src/connection.c
mylog(LOG_DEBUG, "Trying to accept new client on %d", cn->handle);
err = accept(cn->handle, &sa, &sa_len);
if (err < 0) {
mylog(LOG_ERROR, "accept failed: %s", strerror(errno));
return NULL;
}
if (err >= FD_SETSIZE) {
mylog(LOG_WARN, "too many client connected, close %d", err);
if (close(err) == -1)
mylog(LOG_WARN, "Error on socket close: %s",
strerror(errno));
return NULL;
}
socket_set_nonblock(err);
conn = connection_init(cn->anti_flood, cn->ssl, cn->timeout, 0);
src/irc.c
if (conn == bip->listener) {
struct link_client *n = irc_accept_new(conn);
assert(n);
list_add_last(&bip->conn_list, CONN(n));
list_add_last(&bip->connecting_client_list, n);
if (n) {
list_add_last(&bip->conn_list, CONN(n));
list_add_last(&bip->connecting_client_list, n);
}
return;
}
    (1-1/1)