Bugs item #440568, was opened at 2001-07-11 19:12
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=103152&aid=440568&group_id=3152

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Yon Derek (yond)
Assigned to: Nobody/Anonymous (nobody)
Summary: ADP parsing bug

Initial Comment:
How to repro: create an ADP page like given below. Run
it and watch server log. You'll
see "first", "econd", "hird" instead
of "first", "second", "third" in other words parsing
eats first letter for all but first element inside a
tag.

Problem: the test for '=' will advance to next
character even if there is no '='.

Patch attached and inline:

Index: adpparse.c
=======================================================
============
RCS file: /cvsroot/opennsd-4/nsd/adpparse.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 adpparse.c
--- adpparse.c  2001/06/03 16:44:21     1.1.1.1
+++ adpparse.c  2001/07/12 02:58:30
@@ -329,17 +329,19 @@
            ++s;
        }

-       if (*s++ != '=') {
+       if (*s != '=') {
            /*
             * Use attribute name as value.
             */

            vs = as;
        } else {
+           /* found '=', so skip it */
+           ++s;
+
            /*
             * Trim spaces and/or quotes from value.
             */
-
            while (s < e && isspace(UCHAR(*s))) {
                ++s;
            }



test.adp page:

<html>
<body>
Test adp

<%
proc proc_if { string tagset } {
  ns_log Notice "Inside proc_if"
  ns_log Notice "STRING: $string"

  set size [ns_set size $tagset]

  ns_log Notice "!KSTART"
  for { set i 0 } { $i < $size } { incr i } {
    set k [ns_set key $tagset $i]
    set v [ns_set value $tagset $i]
    ns_log Notice "!K $k"
    ns_log Notice "!V $v"
  }
  ns_log Notice "!KEND"
}

ns_register_adptag "if" "/if" proc_if

ns_adp_parse -string "<if first second third   fourth>
hello
</if>"

%>

</body>
</html>


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

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

Reply via email to