mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
security_dac: Avoid segfault when no label is requested
When no DAC "label" was requested for a domain the DAC manager tried to strdup a NULL string causing a segfault.
This commit is contained in:
parent
f2bb32b1d2
commit
f2b241e6a7
@ -890,6 +890,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
|
||||
break;
|
||||
case VIR_DOMAIN_SECLABEL_NONE:
|
||||
/* no op */
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -899,7 +900,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
|
||||
}
|
||||
|
||||
if (!seclabel->norelabel) {
|
||||
if (seclabel->imagelabel == NULL) {
|
||||
if (seclabel->imagelabel == NULL && seclabel->label != NULL) {
|
||||
seclabel->imagelabel = strdup(seclabel->label);
|
||||
if (seclabel->imagelabel == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
Loading…
x
Reference in New Issue
Block a user