Skip to content

Commit

Permalink
Fix possible race-collision leading to a theoretical out-of-bounds read
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Nov 22, 2023
1 parent 1a11413 commit d992e92
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit d992e92

Please sign in to comment.