Bugs item #536541, was opened at 2002-03-28 15:50
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=536541&group_id=3152

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Pierre Asselin (pierrethebom)
Assigned to: Nobody/Anonymous (nobody)
Summary: ParseQuery() clobbers its form arg.

Initial Comment:
This is from the 4.x cvs snapshot.  nsd/form.c:ParseQuery() scans the
form[] array for '&' and '='.  It clobbers them to '\0' to temporarily
chop the string, restores the '=' but leaves the '&' clobbered.
Probably a silent bug, but contradicts the "Side effects: None." in the
introductory comments.

This humble patch would fix it.  Not tested.

--- form.c      Mon Nov  5 12:23:49 2001
+++ form.c.modif        Thu Mar 28 15:28:33 2002
@@ -192,25 +192,28 @@ ParseQuery(char *form, Ns_Set *set, Tcl_
     Tcl_DStringInit(&vds);
     p = form;
     while (p != NULL) {
         k = p;
         p = strchr(p, '&');
         if (p != NULL) {
-            *p++ = '\0';
+            *p = '\0';
         }
         v = strchr(k, '=');
         if (v != NULL) {
             *v = '\0';
         }
         k = Decode(&kds, k, encoding);
         if (v != NULL) {
             Decode(&vds, v+1, encoding);
             *v = '=';
             v = vds.string;
         }
         Ns_SetPut(set, k, v);
+        if (p != NULL) {
+            *p++ = '&';
+        }
     }
     Tcl_DStringFree(&kds);
     Tcl_DStringFree(&vds);
 }




----------------------------------------------------------------------

You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=536541&group_id=3152

Reply via email to