--- src/util/virstring.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/util/virstring.c b/src/util/virstring.c index 1cd4987..e48c29a 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -976,6 +976,21 @@ static const char control_chars[] = "\x10\x11\x12\x13\x14\x15\x16\x17" "\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"; + +static bool +virStringIsControlChar(char c) +{ + const char *cch; + + for (cch = control_chars; *cch; cch++) { + if (*cch == c) + return true; + } + + return false; +} + + bool virStringHasControlChars(const char *str) { @@ -1003,7 +1018,7 @@ virStringStripControlChars(char *str) len = strlen(str); for (i = 0, j = 0; i < len; i++) { - if (index(control_chars, str[i])) + if (virStringIsControlChar(str[i])) continue; str[j++] = str[i]; -- 2.3.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list