appliedsec / pygeoip

DEPRECATED: Pure Python API for Maxmind's binary GeoIP databases
https://github.com/appliedsec/pygeoip
GNU Lesser General Public License v3.0
481 stars 111 forks source link

Invalid region name #9

Closed Nahor closed 12 years ago

Nahor commented 12 years ago

I didn't actually try but this code doesn't look right: region = ''.join([chr((seek_region // 1000) // 26 + 65), chr((seek_region // 1000) % 26 + 65)])

I believe it should be: region = ''.join([chr((seek_region - 1000) // 26 + 65), chr((seek_region - 1000) % 26 + 65)])

which makes more sense and is what the C code does: region->region[0] = (char) ((seek_region - 1000)/26 + 65); region->region[1] = (char) ((seek_region - 1000)%26 + 65);

tiwilliam commented 12 years ago

Fixed in commit 14075edc2c18f56ba0820ff6a69627aa97be3c73