mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
conf: check size of secret file for secret object
Since the empty file with a .base64 value wasn't recognized during the loading process (starting of libvirtd), attempting to get a value for the UUID resulted in an undefined error. This patch resolves the issue by checking the size of the file and ensuring that the stored value is as expected (NULL). Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Adam Julis <ajulis@redhat.com>
This commit is contained in:
parent
4819a14fec
commit
62b961d64c
@ -836,6 +836,11 @@ virSecretLoadValue(virSecretObj *obj)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (st.st_size < 1) {
|
||||||
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
contents = g_new0(char, st.st_size + 1);
|
contents = g_new0(char, st.st_size + 1);
|
||||||
|
|
||||||
if (saferead(fd, contents, st.st_size) != st.st_size) {
|
if (saferead(fd, contents, st.st_size) != st.st_size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user