Escape `>' signs in the XML output.

* src/libutil/xml-writer.cc (nix::XMLWriter::writeAttrs): Escape `>'.
This commit is contained in:
Ludovic Courtès 2010-03-31 08:29:01 +00:00
parent 71be50cc25
commit eb07a4f1ee

View file

@ -91,6 +91,7 @@ void XMLWriter::writeAttrs(const XMLAttrs & attrs)
char c = i->second[j]; char c = i->second[j];
if (c == '"') output << "&quot;"; if (c == '"') output << "&quot;";
else if (c == '<') output << "&lt;"; else if (c == '<') output << "&lt;";
else if (c == '>') output << "&gt;";
else if (c == '&') output << "&amp;"; else if (c == '&') output << "&amp;";
/* Escape newlines to prevent attribute normalisation (see /* Escape newlines to prevent attribute normalisation (see
XML spec, section 3.3.3. */ XML spec, section 3.3.3. */