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:
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…
x
Reference in New Issue
Block a user