[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit d44ab0485cb7ae072c604a3a9fe29715f4cdbc0f
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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);
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits