This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from maxmind/greg/do-not-follow-invalid-pointers
Do not follow invalid pointers when traversing search tree
- Loading branch information
Showing
7 changed files
with
109 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
sudo: false | ||
|
||
language: c | ||
|
||
compiler: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "GeoIP.h" | ||
|
||
int main() | ||
{ | ||
GeoIP *gi = GeoIP_open(SRCDIR "/README.md", GEOIP_MEMORY_CACHE); | ||
|
||
/* We don't detect invalid files at load, unfortunately. */ | ||
if (gi == NULL) { | ||
fprintf(stderr, "Error opening database\n"); | ||
return 1; | ||
} | ||
|
||
const char *country = GeoIP_country_code_by_addr(gi, "24.24.24.24"); | ||
if (country != NULL) { | ||
fprintf( | ||
stderr, | ||
"Received a non-NULL value on an invalid database from GeoIP_country_code_by_addr\n"); | ||
return 1; | ||
} | ||
|
||
country = GeoIP_country_code_by_addr_v6(gi, "24.24.24.24"); | ||
if (country != NULL) { | ||
fprintf( | ||
stderr, | ||
"Received a non-NULL value on an invalid database from GeoIP_country_code_by_addr_v6\n"); | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |