diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 0444611c184..f0b49db3fe9 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -7975,17 +7975,21 @@ CM_Set_Class_Registry_PropertyW( if (ulProperty == CM_CRP_SECURITY_SDS) { - if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer, - SDDL_REVISION_1, - &pSecurityDescriptor, - &SecurityDescriptorSize)) + if (ulLength != 0) { - ERR("ConvertStringSecurityDescriptorToSecurityDescriptorW() failed (Error %lu)\n", GetLastError()); - return CR_INVALID_DATA; + if (!ConvertStringSecurityDescriptorToSecurityDescriptorW((LPCWSTR)Buffer, + SDDL_REVISION_1, + &pSecurityDescriptor, + &SecurityDescriptorSize)) + { + ERR("ConvertStringSecurityDescriptorToSecurityDescriptorW() failed (Error %lu)\n", GetLastError()); + return CR_INVALID_DATA; + } + + Buffer = (PCVOID)pSecurityDescriptor; + ulLength = SecurityDescriptorSize; } - Buffer = (PCVOID)pSecurityDescriptor; - ulLength = SecurityDescriptorSize; ulProperty = CM_CRP_SECURITY; ulType = REG_BINARY; }