[tbb-commits] [torbutton/maint-1.9.3] Bug 16990: Avoid matching '250 ' to the end of node name

gk at torproject.org gk at torproject.org
Tue Nov 10 10:28:12 UTC 2015


commit c0e4b60c3dea82ad49d366038d5d950077a1c0fe
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Thu Nov 5 08:15:16 2015 -0800

    Bug 16990: Avoid matching '250 ' to the end of node name
---
 src/modules/tor-control-port.js |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/modules/tor-control-port.js b/src/modules/tor-control-port.js
index de9f10a..2b41897 100644
--- a/src/modules/tor-control-port.js
+++ b/src/modules/tor-control-port.js
@@ -517,11 +517,11 @@ info.stringToValue = function (string) {
       key = matchForKey ? matchForKey[1] : null;
   if (key === null) return null;
   // matchResult finds a single-line result for `250-` or a multi-line one for `250+`.
-  let matchResult = string.match(/250[ -].+?=(.*?)$/mi) ||
-                    string.match(/250\+.+?=([\s\S]*?)^\.$/mi),
+  let matchResult = string.match(/^250[ -].+?=(.*?)$/mi) ||
+                    string.match(/^250\+.+?=([\s\S]*?)^\.$/mi),
       // Retrieve the captured group (the text of the value in the key-value pair)
       valueString = matchResult ? matchResult[1] : null,
-      // Get the parser functino for the key found.
+      // Get the parser function for the key found.
       parse = info.getParser(key.toLowerCase());
   if (parse === undefined) {
     throw new Error("No parser found for '" + key + "'");



More information about the tbb-commits mailing list