]> xenbits.xensource.com Git - libvirt.git/commitdiff
Ignore storage volumes with control codes in their names
authorJán Tomko <jtomko@redhat.com>
Tue, 14 Apr 2015 10:30:55 +0000 (12:30 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 15 Apr 2015 16:41:20 +0000 (18:41 +0200)
To prevent generating invalid XML.

https://bugzilla.redhat.com/show_bug.cgi?id=1066564

src/storage/storage_backend_fs.c

index d4d65bcf2ea3dd8499bdeb310423707dcd7c0f38..521dc700751d646f397f17e4c9d264bfcff81956 100644 (file)
@@ -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 under '%s'",
+                     pool->def->target.path);
+            continue;
+        }
+
         if (VIR_ALLOC(vol) < 0)
             goto error;