mirror of https://gitee.com/openkylin/libvirt.git
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:
parent
de12bee7eb
commit
94f776e716
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue