mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +00:00
virStorageBackendISCSISetAuth: Use g_strndup to '\0' terminate data
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
fbb323fe61
commit
edd644e7a8
@ -283,10 +283,8 @@ virStorageBackendISCSISetAuth(const char *portal,
|
|||||||
&secret_value, &secret_size) < 0)
|
&secret_value, &secret_size) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
secret_str = g_new0(char, secret_size + 1);
|
secret_str = g_strndup((char *) secret_value, secret_size);
|
||||||
memcpy(secret_str, secret_value, secret_size);
|
|
||||||
virSecureErase(secret_value, secret_size);
|
virSecureErase(secret_value, secret_size);
|
||||||
secret_str[secret_size] = '\0';
|
|
||||||
|
|
||||||
if (virISCSINodeUpdate(portal,
|
if (virISCSINodeUpdate(portal,
|
||||||
source->devices[0].path,
|
source->devices[0].path,
|
||||||
|
Loading…
Reference in New Issue
Block a user