[PATCH] secret: Check length of value in secret object

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

 



Ensure that the value in the secret object is validated not only for NULL
but also for its size. An empty value may not always be NULL, if it has
been manually deleted from the .base64 file.

Signed-off-by: Adam Julis <ajulis@xxxxxxxxxx>
---
 src/conf/virsecretobj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index 455798d414..3cb1ec2b4b 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -719,7 +719,7 @@ virSecretObjGetValue(virSecretObj *obj)
     virSecretDef *def = obj->def;
     unsigned char *ret = NULL;
 
-    if (!obj->value) {
+    if (!obj->value || (obj->value_size < 1 )) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(def->uuid, uuidstr);
         virReportError(VIR_ERR_NO_SECRET,
-- 
2.47.1




[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]

  Powered by Linux