提交 f2b241e6 编写于 作者: P Peter Krempa

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.
上级 f2bb32b1
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册