Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible crash with high client activity #1777

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/database/network-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,15 @@ static int update_netDB_interface(sqlite3 *db, const int network_id, const char

// Loop over all clients known to FTL and ensure we add them all to the database
static bool add_FTL_clients_to_network_table(sqlite3 *db, enum arp_status *client_status, time_t now,
unsigned int *additional_entries)
unsigned int *additional_entries, int num_clients)
{
// Return early if database is known to be broken
if(FTLDBerror())
return false;

int rc = SQLITE_OK;
char hwaddr[128];
for(int clientID = 0; clientID < counters->clients; clientID++)
for(int clientID = 0; clientID < num_clients; clientID++)
{
// Check thread cancellation
if(killed)
Expand Down Expand Up @@ -1536,7 +1536,7 @@ void parse_neighbor_cache(sqlite3* db)

// Loop over all clients known to FTL and ensure we add them all to the
// database
if(!add_FTL_clients_to_network_table(db, client_status, now, &additional_entries))
if(!add_FTL_clients_to_network_table(db, client_status, now, &additional_entries, clients))
return;

// Check thread cancellation
Expand Down