* src/buf.c: avoid an XML attribute escaping bug #499791

daniel
This commit is contained in:
Daniel Veillard 2009-05-13 16:19:59 +00:00
parent 0d11a25e6d
commit 7afe94e7e2
2 changed files with 19 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Wed May 13 18:06:17 CEST 2009 Daniel Veillard <veillard@redhat.com>
* src/buf.c: avoid an XML attribute escaping bug #499791
Wed May 13 12:34:06 BST 2009 Daniel P. Berrange <berrange@redhat.com>
* src/lxc_container.c: Replace sys/capability.h with

View File

@ -266,7 +266,7 @@ virBufferEscapeString(const virBufferPtr buf, const char *format, const char *st
return;
len = strlen(str);
if (VIR_ALLOC_N(escaped, 5 * len + 1) < 0) {
if (VIR_ALLOC_N(escaped, 6 * len + 1) < 0) {
virBufferNoMemory(buf);
return;
}
@ -290,6 +290,20 @@ virBufferEscapeString(const virBufferPtr buf, const char *format, const char *st
*out++ = 'm';
*out++ = 'p';
*out++ = ';';
} else if (*cur == '"') {
*out++ = '&';
*out++ = 'q';
*out++ = 'u';
*out++ = 'o';
*out++ = 't';
*out++ = ';';
} else if (*cur == '\'') {
*out++ = '&';
*out++ = 'a';
*out++ = 'p';
*out++ = 'o';
*out++ = 's';
*out++ = ';';
} else if ((*cur >= 0x20) || (*cur == '\n') || (*cur == '\t') ||
(*cur == '\r')) {
/*