[PATCH 2/6] virSecretLoadValue: Don't re-termiante the buffer

Peter Krempa via Devel posted 6 patches 6 days, 7 hours ago
[PATCH 2/6] virSecretLoadValue: Don't re-termiante the buffer
Posted by Peter Krempa via Devel 6 days, 7 hours ago
From: Peter Krempa <pkrempa@redhat.com>

The buffer returned from 'virFileReadAll' is NUL terminated no need to
do it explicitly or to shorten it since this is now also done.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/virsecretobj.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c
index b448be493a..82a61a747a 100644
--- a/src/conf/virsecretobj.c
+++ b/src/conf/virsecretobj.c
@@ -908,9 +908,6 @@ virSecretLoadValue(virSecretObj *obj,
         if ((filelen = virFileReadAll(filename, secretFileMaxLen, &filecontent)) < 0)
             return -1;

-        filecontent = g_realloc(filecontent, filelen + 1);
-        filecontent[filelen] = '\0';
-
         decoded = g_base64_decode(filecontent, &decodedlen);

         virSecureErase(filecontent, filelen);
-- 
2.53.0