[libvirt] [PATCHv2 4/5] Ignore storage volumes with control codes in their names

Ján Tomko jtomko at redhat.com
Tue Apr 14 11:28:49 UTC 2015


To prevent generating invalid XML.

https://bugzilla.redhat.com/show_bug.cgi?id=1066564
---
 src/storage/storage_backend_fs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index d4d65bc..fb33f08 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -860,6 +860,12 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
     while ((direrr = virDirRead(dir, &ent, pool->def->target.path)) > 0) {
         int ret;
 
+        if (virStringHasControlChars(ent->d_name)) {
+            VIR_WARN("Ignoring file with control characters in its name: '%s'",
+                     ent->d_name);
+            continue;
+        }
+
         if (VIR_ALLOC(vol) < 0)
             goto error;
 
-- 
2.0.5




More information about the libvir-list mailing list