1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

virBufferEscapeShell: Fix escaping of single quotes.

When checking if we need to escape a single quote we were looking at the
character after the quote instead of at the quote itself.
This commit is contained in:
Guido Günther 2011-10-18 09:07:41 +02:00
parent de12bee7eb
commit 94f776e716

View File

@ -524,13 +524,13 @@ virBufferEscapeShell(virBufferPtr buf, const char *str)
*out++ = '\'';
while (*cur != 0) {
*out++ = *cur++;
if (*cur == '\'') {
*out++ = '\'';
/* Replace literal ' with a close ', a \', and a open ' */
*out++ = '\\';
*out++ = '\'';
*out++ = '\'';
}
*out++ = *cur++;
}
*out++ = '\'';
*out = 0;