mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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;
|
break;
|
||||||
case VIR_DOMAIN_SECLABEL_NONE:
|
case VIR_DOMAIN_SECLABEL_NONE:
|
||||||
/* no op */
|
/* no op */
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -899,7 +900,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!seclabel->norelabel) {
|
if (!seclabel->norelabel) {
|
||||||
if (seclabel->imagelabel == NULL) {
|
if (seclabel->imagelabel == NULL && seclabel->label != NULL) {
|
||||||
seclabel->imagelabel = strdup(seclabel->label);
|
seclabel->imagelabel = strdup(seclabel->label);
|
||||||
if (seclabel->imagelabel == NULL) {
|
if (seclabel->imagelabel == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user