markabrahams / node-net-snmp

JavaScript implementation of the Simple Network Management Protocol (SNMP)
209 stars 97 forks source link

ParseInt in column number fails on 2+ whitespace characters between Object name and ID #229

Closed ungrim97 closed 1 year ago

ungrim97 commented 1 year ago

Hopefully I have used the correct terminology, I am not overly familiar with nomenclature of MIBs/Modules/SNMP.

When populating the number value for column defintions, only a single whitespace character is allowed between the Object name and the numeric value, I believe that any none zero amount of whitespace is permissible between these two.

e.g the following should both be valid:

    ::= { interfaces 2 }
    ::= { interfaces     2 }

At the moment additional whitespace causes an empty string to be parsed as an Int which results in a column number of NaN.

The MIB file is successfully parsed by other MIB parsers.

markabrahams commented 1 year ago

Thanks for reporting this @ungrim97! I've added a fix for this condition in the MIB parser itself, as it's preferable to fix closer to the source of the issue. I've published the fix in version 3.9.5 of the npm.

ungrim97 commented 1 year ago

@markabrahams Have pulled latest version and it appears to work as expected. Thank you