[Pkg-javascript-commits] [node-asn1.js] 136/202: lib: `numstr` validation fix

Bastien Roucariès rouca at moszumanska.debian.org
Thu Apr 20 19:19:01 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-asn1.js.

commit fc98800beb2ced18a5254b5f6b22bda65ca599e4
Author: Aleksey Timchenko <flegmatik.bel at gmail.com>
Date:   Mon Nov 30 11:15:03 2015 +0300

    lib: `numstr` validation fix
---
 lib/asn1/base/node.js  | 2 +-
 test/ping-pong-test.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/asn1/base/node.js b/lib/asn1/base/node.js
index 057bf7d..83fd15d 100644
--- a/lib/asn1/base/node.js
+++ b/lib/asn1/base/node.js
@@ -603,7 +603,7 @@ Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
 };
 
 Node.prototype._isNumstr = function isNumstr(str) {
-  return /^[1-9 ]*$/.test(str);
+  return /^[0-9 ]*$/.test(str);
 };
 
 Node.prototype._isPrintstr = function isPrintstr(str) {
diff --git a/test/ping-pong-test.js b/test/ping-pong-test.js
index 709a9a7..0e2be0a 100644
--- a/test/ping-pong-test.js
+++ b/test/ping-pong-test.js
@@ -47,7 +47,7 @@ describe('asn1.js ping/pong', function() {
 
     test('numstr', function() {
       this.numstr();
-    }, '1234 5678');
+    }, '1234 5678 90');
 
     test('printstr', function() {
       this.printstr();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-asn1.js.git



More information about the Pkg-javascript-commits mailing list