Skip to content


!ip check in lookup function #7

merged 1 commit into from

2 participants


Node's net.isIP() incorrectly returns 4 when passed null or undefined, so I've implemented a simple check to return null if the lookup function is passed null or undefined. Otherwise, a fatal error occurs when aton4() is subsequently passed null or undefined.

@bluesmoon bluesmoon merged commit b5f9bef into bluesmoon:master

thanks for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 27, 2012
  1. @jordanj77
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/geoip.js
2 lib/geoip.js
@@ -238,6 +238,8 @@ function ntoa6(n) {
exports.lookup = function(ip) {
+ if(!ip)
+ return null;
if(typeof ip == 'number')
return lookup4(ip);
if(net.isIP(ip) === 4)
Something went wrong with that request. Please try again.