delian / node-netflowv9

NetFlow Version 9 library for Node.JS
GNU General Public License v2.0
42 stars 14 forks source link

Fix issue when type is not defined in nfTypes #18

Closed gavinaiken closed 6 years ago

gavinaiken commented 6 years ago

One of our systems collecting netflow was throwing a regular error like this:

node-netflowv9/js/nf9/nf9decode.js:147
            debug('    FIELD type: %d (%s) len: %d, plen: %d', type,nfTypes[type].name,tlen,plen);
                                                                                  ^
TypeError: Cannot read property 'name' of undefined
    at readOptions (node-netflowv9/js/nf9/nf9decode.js:147:83)
    at NetFlowV9.nf9PktDecode (node-netflowv9/js/nf9/nf9decode.js:164:29)
    at NetFlowV9.nfPktDecode (node-netflowv9/netflowv9.js:33:25)
    at Immediate.NetFlowV9.fetch [as _onImmediate] (node-netflowv9/netflowv9.js:139:24)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

and the attached patch resolved the problem.

delian commented 6 years ago

I am going to merge the patch

delian commented 6 years ago

A new version 0.2.13 with the patch is published

Delian

On Wed, Jun 27, 2018 at 11:08 AM Gavin Aiken notifications@github.com wrote:

One of our systems collecting netflow was throwing a regular error like this:

node-netflowv9/js/nf9/nf9decode.js:147 debug(' FIELD type: %d (%s) len: %d, plen: %d', type,nfTypes[type].name,tlen,plen); ^ TypeError: Cannot read property 'name' of undefined at readOptions (node-netflowv9/js/nf9/nf9decode.js:147:83) at NetFlowV9.nf9PktDecode (node-netflowv9/js/nf9/nf9decode.js:164:29) at NetFlowV9.nfPktDecode (node-netflowv9/netflowv9.js:33:25) at Immediate.NetFlowV9.fetch [as _onImmediate] (node-netflowv9/netflowv9.js:139:24) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5)

and the attached patch resolved the problem.

You can view, comment on, or merge this pull request online at:

https://github.com/delian/node-netflowv9/pull/18 Commit Summary

  • Fix issue when type is not defined in nfTypes

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/delian/node-netflowv9/pull/18, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG7Zp5URrPWGVG9nEh3Ce04bQASR18Aks5uA0uggaJpZM4U5VLr .

gavinaiken commented 6 years ago

thanks!