[PATCH v2] conf: prevent crash with no uuid in cephx auth secret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also remove the pointless check for NULL in auth.cephx.secret.uuid,
since this is a static array.
---
 src/conf/storage_conf.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3fdc5b6..99c2e52 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -458,7 +458,7 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
         return -1;
     }
 
-    if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
+    if (uuid && virUUIDParse(uuid, auth->secret.uuid) < 0) {
         virReportError(VIR_ERR_XML_ERROR,
                        "%s", _("invalid auth secret uuid"));
         return -1;
@@ -979,10 +979,8 @@ virStoragePoolSourceFormat(virBufferPtr buf,
                           src->auth.cephx.username);
 
         virBufferAsprintf(buf,"      %s", "<secret");
-        if (src->auth.cephx.secret.uuid != NULL) {
-            virUUIDFormat(src->auth.cephx.secret.uuid, uuid);
-            virBufferAsprintf(buf," uuid='%s'", uuid);
-        }
+        virUUIDFormat(src->auth.cephx.secret.uuid, uuid);
+        virBufferAsprintf(buf," uuid='%s'", uuid);
 
         if (src->auth.cephx.secret.usage != NULL) {
             virBufferAsprintf(buf," usage='%s'", src->auth.cephx.secret.usage);
-- 
1.7.8.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]