Skip to content

Commit

Permalink
Check return value of record_info_for_database()
Browse files Browse the repository at this point in the history
Currently we will have an assertion failure if this happens, but we're
thinking of removing that.
  • Loading branch information
horgh committed Nov 2, 2023
1 parent 83758e5 commit 30853b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/maxminddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,9 @@ static int find_ipv4_start_node(MMDB_s *const mmdb) {
}

record_info_s record_info = record_info_for_database(mmdb);
if (record_info.right_record_offset == 0) {
return MMDB_UNKNOWN_DATABASE_FORMAT_ERROR;
}

const uint8_t *search_tree = mmdb->file_content;
uint32_t node_value = 0;
Expand Down

0 comments on commit 30853b1

Please sign in to comment.