- Use autoconf to check the system's endianness rather than trying to do this
with compiler-defined macros like
__BYTE_ORDER__
. Apparently this didn't work properly on a Sparc system. GitHub #120. - Several compiler warnings on Visual C++ were fixed. Pull request by Marcel Raad. GitHub #130.
- Fix segmentation faults found in
MMDB_open()
using afl-fuzz. This occurred on corrupt databases that had a data pointer large enough to cause an integer overflow when doing bound checking. Reported by Ryan Whitworth. GitHub #140. - Add --disable-tests option to
configure
. Pull request by Fabrice Fontaine. GitHub #136.
- Four additional fields were added to the end of the
MMDB_search_node_s
struct returned byMMDB_read_node
. These fields allow the user to iterate through the search tree without making undocumented assumptions about how this library works internally and without knowing the specific details of the database format. GitHub #110.
- Previously, reading a database with a pointer in the metadata would cause an
MMDB_INVALID_METADATA_ERROR
to be returned. This was due to an invalid offset being used when calculating the pointer. Thedata_section
andmetadata_section
fields now both point to the beginning of the data section. Previously,data_section
pointed to the beginning of the data separator. This will not affect anyone using only documented fields fromMMDB_s
. MMDB_lookup_sockaddr
will setmmdb_error
toMMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR
if an IPv6sockaddr
is looked up in an IPv4-only database. Previously onlyMMDB_lookup_string
would set this error code.- When resolving an address, this library now relies on
getaddrinfo
to determine the address family rather than trying to guess it itself.
- Packaging fixes. The 1.1.3 tarball release contained a lot of extra junk in the t/ directory.
- Added several additional checks to make sure that we don't attempt to read past the end of the databases's data section. Implemented by Tobias Stoeckmann. GitHub #103.
- When searching for the database metadata, there was a bug that caused the code to think it had found valid metadata when none existed. In addition, this could lead to an attempt to read past the end of the database entirely. Finally, if there are multiple metadata markers in the database, we treat the final one as the start of the metdata, instead of the first. Implemented by Tobias Stoeckmann. GitHub #102.
- Don't attempt to mmap a file that is too large to be mmapped on the system. Implemented by Tobias Stoeckmann. GitHub #101.
- Added a missing out of memory check when reading a file's metadata. Implemented by Tobias Stoeckmann. GitHub #101.
- Added several additional checks to make sure that we never attempt to
malloc
more thanSIZE_MAX
memory, which would lead to integer overflow. This could only happen with pathological databases. Implemented by Tobias Stoeckmann. GitHub #101.
- IMPORTANT: This release includes a number of important security fixes. Among
these fixes is improved validation of the database metadata. Unfortunately,
MaxMind GeoIP2 and GeoLite2 databases created earlier than January 28, 2014
had an invalid data type for the
record_size
in the metadata. Previously these databases worked on little endian machines with libmaxminddb but did not work on big endian machines. Due to increased safety checks when reading the file, these databases will no longer work on any platform. If you are using one of these databases, we recommend that you upgrade to the latest GeoLite2 or GeoIP2 database - Added pkg-config support. If your system supports it, then running
make install
now installs alibmaxminddb.pc
file for pkgconfig. Implemented by Jan Vcelak. - Several segmentation faults found with afl-fuzz were fixed. These were caused by missing bounds checking and missing data type verification checks.
MMDB_get_entry_data_list
will now fail on data structures with a depth greater than 512 and data structures that are cyclic. This should not affect any known MaxMind DB in production. All databases produced by MaxMind have a depth of less than five.
- Added
maxminddb-compat-util.h
as a source file to dist.
- Previously, when there was an error in
MMDB_open()
,errno
would generally be overwritten during cleanup, preventing a useful value from being returned to the caller. This was changed so that theerrno
value from the function call that caused the error is restored before returning to the caller. In particular, this is important forMMDB_IO_ERROR
errors as checkingerrno
is often the only way to determine what actually failed. - If
mmap()
fails due to running out of memory space, anMMDB_OUT_OF_MEMORY_ERROR
is now returned fromMMDB_open
rather than anMMDB_IO_ERROR
. - On Windows, the
CreateFileMappingA()
handle was not properly closed if opening the database succeeded. Fixed by Bly Hostetler. GitHub #75 & #76. - On Windows, we were not checking the return value of
CreateFileMappingA()
properly for errors. Fixed by Bly Hotetler. GitHub #78. - Several warnings from Clang's scan-build were fixed. GitHub #86.
- All headers are now installed in
$(includedir)
. GitHub #89. - We no longer install
maxminddb-compat-util.h
. This header was intended for internal use only.
- If you used a non-integer string as an array index when doing a lookup with
MMDB_get_value()
,MMDB_vget_value()
, orMMDB_aget_value()
, the first element of the array would be returned rather than an error. AMMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR
error will now be returned. GitHub #61. - If a number larger than
LONG_MAX
was used in the same functions,LONG_MAX
would have been used in the lookup. Now aMMDB_INVALID_LOOKUP_PATH_ERROR
error will be returned. - Visual Studio build files were added for unit tests and some compatibility issues with the tests were fixed.
- Visual Studio project was updated to use property pages. Patch by Andre. GitHub #69.
- A test failure in
t/compile_c++_t.pl
on new installs was fixed.
- A memory and file handle leak on Win32 was fixed when getting the database size fails. Patch by Federico G. Schwindt. GitHub PR #49.
- Documentation fix. Federico G. Schwindt. GitHub PR #50.
- Added Visual Studio build files and fixed incorrect CreateFileMappingA usage. Patch by Andre. GitHub #52.
- The includes for the Windows header files were made lowercase in order to match the actual file names on case-sensitive file systems. GitHub PR #57.
- Removed
realloc()
calls that caused warnings on Windows and generally cleaned up memory allocation inMMDB_vget_value()
. See relevant discussion in GitHub #52. - Added an
extern "C" { ... }
wrapper to maxminddb.h when compiling with a C++ compiler. GitHub #55.
- Fixed a number of small issues found by Coverity.
- When freeing the MMDB struct in
MMDB_close()
we make sure to set the pointers to NULL after freeing the memory they point to. This makes it safe to callMMDB_close
more than once on the sameMMDB_s
struct pointer. Before this change, calling this function twice on the same pointer could cause the code to free memory that belonged to something else in the process. Patch by Shuxin Yang. GitHub PR #41.
- Added missing LICENSE and NOTICE files to distribution. No code changes.
- Bumped version to 1.0.0. No code changes.
- There was a leak in the
MMDB_open()
sub when it was called against a file which did not contain any MMDB metadata. Reported by Federico G. Schwindt. GitHub issue #36. - Fixed an error that occurred when passing AI_V4MAPPED to
getaddrinfo()
on FreeBSD. Apparently this macro is defined but doesn't work the way we expected it to on that platform. - Made sure to call
freeaddrinfo()
when a call togetaddrinfo()
fails but still allocated memory. - Fixed a segfault in the tests that occurred on FreeBSD if we passed a NULL
value to
freeaddrinfo()
. - Added a missing step to the README.md file for installing from our GitHub repository. Patch by Yasith Fernando.
- Added instructions for installing via Homebrew. Patch by Yasith Fernando.
- The previous tarball failed to compile because it was missing the src/maxminddb-compat-util.h file. Reported by Günter Grodotzki. GitHub issue #18.
- Added support for compiling in the MinGW environment. Patch by Michael Eisendle.
- Added const declarations to many spots in the public API. None of these should require changes to existing code.
- Various documentation improvements.
- Changed the license to the Apache 2.0 license.
- The internal value_for_key_as_uint16 method was returning a uint32_t instead of a uint16_t. Reported by Robert Wells. GitHub issue #11.
- The ip_version member of the MMDB_metadata_s struct was a uint8_t, even though the docs and spec said it should be a uint16_t. Reported by Robert Wells. GitHub issue #11.
- The mmdblookup_t.pl test now reports that it needs IPC::Run3 to run (which it always did, but it didn't tell you this). Patch by Elan Ruusamäe. GitHub issue #10.
- Running
make
from the tarball failed. This is now fixed.
- Renamed MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA define to MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR for consistency. Fixes github issue #5. Reported by Albert Strasheim.
- Updated README.md to show git clone with --recursive flag so you get the needed submodules. Fixes github issue #4. Reported by Ryan Peck.
- Fixed some bugs with the MMDB_get_*value functions when navigating a data structure that included pointers. Fixes github issue #3. Reported by bagadon.
- Fixed compilation problems on OSX and OpenBSD. We have tested this on OSX and OpenBSD 5.4. Fixes github issue #6.
- Removed some unneeded memory allocations and added const to many variable declarations. Based on patches by Timo Teräs. Github issue #8.
- Added a test that uses threads to check for thread safety issue in the library.
- Distro tarball now includes man pages, tests, and test data