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; }