From 032ab8d66efec2f3de2ee5a3eb4a6a57c998dd5d Mon Sep 17 00:00:00 2001 From: Alexandr Korepanov Date: Wed, 8 Jul 2015 14:18:42 +0300 Subject: [PATCH] Fix _extract_record core dump --- libGeoIP/GeoIPCity.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libGeoIP/GeoIPCity.c b/libGeoIP/GeoIPCity.c index 8e7ffc2..a4cfb96 100644 --- a/libGeoIP/GeoIPCity.c +++ b/libGeoIP/GeoIPCity.c @@ -96,6 +96,10 @@ _extract_record(GeoIP * gi, unsigned int seek_record, int *next_record_ptr) return NULL; } }else { + if (gi->size <= record_pointer) { + /* such record does not exists in the cache */ + return NULL; + } record_buf = gi->cache + (long)record_pointer; }