-
Notifications
You must be signed in to change notification settings - Fork 142
Closed
Description
Hiya Keichi,
Thanks a lot for the library! Really sweet. I've just noticed that since 1.1.3 the zero-terminated string stuff is broken.
Code:
var Parser = require('binary-parser').Parser;
var StringOptions = {length: 99, zeroTerminated:true};
// Build an IP packet header Parser
var ipHeader = new Parser()
.skip(1, StringOptions)
.string("command", StringOptions)
.string("username", StringOptions);
// Prepare buffer to parse.
var buf = new Buffer('0e757365726e616d6500526f6200', 'hex');
// Parse buffer and show result
console.log(ipHeader.parse(buf));Output on 1.1.2:
$ npm install; node test.js
binary-parser@1.1.2 node_modules\binary-parser
{ command: 'username', username: 'Rob' }Output on 1.1.3+
$ npm install; node test.js
binary-parser@1.1.3 node_modules\binary-parser
{ command: 'username\u0000Rob\u0000', username: '' }Don't have the time to look (yet) but maybe I can check it out lateron.
Metadata
Metadata
Assignees
Labels
No labels