]> granicus.if.org Git - pdns/commitdiff
fix parameter parsing in yahttp
authorKees Monshouwer <mind04@monshouwer.org>
Wed, 20 Nov 2013 18:48:19 +0000 (19:48 +0100)
committermind04 <mind04@monshouwer.org>
Wed, 20 Nov 2013 18:48:19 +0000 (19:48 +0100)
pdns/ext/yahttp/yahttp/utility.hpp

index 65413b839575f9650981050fcffb49fca4b2ca41..ba9ed9461d395875e65211d551e1337aa61dabae 100644 (file)
@@ -155,7 +155,7 @@ namespace YaHTTP {
           if (nextpos == std::string::npos) {
             value = parameters.substr(delim+1);
           } else {
-            value = parameters.substr(delim+1, nextpos-delim);
+            value = parameters.substr(delim+1, nextpos-delim-1);
           }
         }
         if (key.empty()) {
@@ -165,8 +165,12 @@ namespace YaHTTP {
         key = decodeURL(key);
         value = decodeURL(value);
         parameter_map[key] = value;
+        if (nextpos == std::string::npos) {
+          // no more parameters left
+          break;
+        }
 
-        pos = nextpos;
+        pos = nextpos+1;
       }
       return parameter_map;
     };