mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virConnectAuthCallbackDefault: Return failure if 'virGetPassword' returns NULL
virGetPassword can return NULL on linux or BSD if it fails. The caller
in virConnectAuthCallbackDefault does dereference it unconditionally.
Return failure if virGetPassword returns NULL.
Fixes: db72866310
Closes: https://gitlab.com/libvirt/libvirt/-/issues/777
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
1 parent
ef4c0050b2
commit
2ecf6fe7bf
1 file changed
+3
-1
+3
-1
@@ -158,7 +158,9 @@ virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
|
||||
if (fflush(stdout) != 0)
|
||||
return -1;
|
||||
|
||||
bufptr = virGetPassword();
|
||||
if (!(bufptr = virGetPassword()))
|
||||
return -1;
|
||||
|
||||
if (STREQ(bufptr, ""))
|
||||
VIR_FREE(bufptr);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user