Commit 144a891a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Correctly check the XML 1.0 names for illegal characters.

Fixes #207



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4434 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7f9941ee
...@@ -53,6 +53,7 @@ SVNID("$Id$") ...@@ -53,6 +53,7 @@ SVNID("$Id$")
#include "shmlog.h" #include "shmlog.h"
#include "vrt.h" #include "vrt.h"
#include "vcl.h" #include "vcl.h"
#include "vct.h"
#include "cache.h" #include "cache.h"
#include "stevedore.h" #include "stevedore.h"
...@@ -314,16 +315,17 @@ esi_attrib(const struct esi_work *ew, txt *in, txt *attrib, txt *val) ...@@ -314,16 +315,17 @@ esi_attrib(const struct esi_work *ew, txt *in, txt *attrib, txt *val)
if (in->b >= in->e) if (in->b >= in->e)
return (0); return (0);
if (!isalpha(*in->b)) { if (!vct_isxmlnamestart(*in->b)) {
/* XXX error */ /* XXX error */
esi_error(ew, in->b, 1, "XML 1.0 Illegal attribute character"); esi_error(ew, in->b, 1,
"XML 1.0 Illegal attribute start character");
return (-1); return (-1);
} }
/* Attribute name until '=' or space */ /* Attribute name until '=' or space */
*attrib = *in; *attrib = *in;
while(in->b < in->e && *in->b != '=' && !isspace(*in->b)) { while(in->b < in->e && *in->b != '=' && !isspace(*in->b)) {
if (!isalnum(*in->b)) { if (!vct_isxmlname(*in->b)) {
esi_error(ew, attrib->b, 1 + (in->b - attrib->b), esi_error(ew, attrib->b, 1 + (in->b - attrib->b),
"XML 1.0 Illegal attribute character"); "XML 1.0 Illegal attribute character");
return (-1); return (-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment