bugcgicc - Bugs: bug #36497, Form Variable Parsing Bug

 
 

bug #36497: Form Variable Parsing Bug

Submitter:  None
Submitted:  Sat 19 May 2012 02:10:12 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 19 May 2012 02:10:12 AM UTC, original submission:  

I googled this but was surprised to find no comments or fixes. Diff is
at the bottom.

W3C says the following at
http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2
We recommend that HTTP server implementors, and in particular, CGI
implementors support the use of ";" in place of "&" to save authors
the trouble of escaping "&" characters in this manner.

The fix below is very simple. It does permit then separation using
either a ; or a & which in my mind isn't very neat but proper URI
encoding requires that any form names or values containing ';' or '&'
be encoded to their % equivalent anyway.


--- Cgicc.cpp   2012-03-04 00:03:35.000000000 -0500
+++ Cgicc.cpp.bak       2012-03-04 00:02:11.000000000 -0500
@@ -365,12 +365,12 @@

      // Decode the name
      name = form_urldecode(data.substr(oldPos, pos - oldPos));
      oldPos = ++pos;

-      // Find the '&' OR ';' separating subsequent name/value pairs
-      pos = data.find_first_of(";&", oldPos);
+      // Find the '&' separating subsequent name/value pairs
+      pos = data.find_first_of('&', oldPos);

      // Even if an '&' wasn't found the rest of the string is a value
      value = form_urldecode(data.substr(oldPos, pos - oldPos));

      // Store the pair

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2013-01-12 sebdiaz Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code