[tor-commits] [flashproxy/master] It's an error if a cookie string is missing '='.

dcf at torproject.org dcf at torproject.org
Fri Dec 28 14:13:54 UTC 2012


commit d44ab0485cb7ae072c604a3a9fe29715f4cdbc0f
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Dec 24 18:01:23 2012 -0800

    It's an error if a cookie string is missing '='.
---
 proxy/flashproxy.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/proxy/flashproxy.js b/proxy/flashproxy.js
index cf22b8d..777fb0d 100644
--- a/proxy/flashproxy.js
+++ b/proxy/flashproxy.js
@@ -98,8 +98,9 @@ function puts(s) {
 }
 
 /* Parse a cookie data string (usually document.cookie). The return type
-   is an object mapping cookies names to values. For a description of the cookie
-   string format see http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-8747038 */
+   is an object mapping cookies names to values. Returns null on error.
+
+   http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-8747038 */
 function parse_cookie_string(cookies) {
     var strings;
     var result;
@@ -114,6 +115,9 @@ function parse_cookie_string(cookies) {
         var j, name, value;
 
         j = string.indexOf("=");
+        if (j === -1) {
+            return null;
+        }
         name = string.substr(0, j);
         value = string.substr(j + 1);
 





More information about the tor-commits mailing list