PaddeK / node-maxmind-db

This is the pure Node API for reading MaxMind DB files. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6).
GNU Lesser General Public License v2.1
88 stars 25 forks source link

crash app when ip is invalid #26

Open truonghoangnguyen opened 8 years ago

truonghoangnguyen commented 8 years ago

I used sailsjs and node-maxmind-db, when ip is invalid, app is crash code in coffee:

         ip = '113.183.205.64,66.249.82.67';
         mmdbreader.open GEOPATH, (error, countries) ->
           countries.getGeoData ip, (error, geodata) ->
             if error
               sails.log.error 'expected come here'
               return callback true, MessageService.common.system(error)
             sails.log.error geodata

thanks

chriskinsman commented 7 years ago

We are seeing this also. Instead of calling the callback with an error we instead get a crash.

In our case we were passing 'undefined' as the IP accidentally and it crashed the process due to no out try/catch block.

knoxcard commented 5 years ago

https://github.com/runk/node-maxmind