summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-01-17 13:49:29 +0100
committerMichael Stahl <mstahl@redhat.com>2018-01-17 13:55:18 +0100
commit566b6f6ec007ef386ad41ced9f6317a4280b6c48 (patch)
tree53668d486d920d90db45d661d13cbb254606a4c7 /sfx2
parentd27561ad071bbb2b7cabb45203515c2e1669476a (diff)
coverity#1427631 sfx2: fix silly infinite loop
(regression from 9ef1734f03a008545a01fd394dd0e979bb230a0f) Change-Id: I31dc5e7aff80f647d8417c290f8f34c43e54486d
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index f19ea1488b63..738ab2564497 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2669,25 +2669,27 @@ ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter,
::rtl::Reference< ::comphelper::DocPasswordRequest > pPasswordRequest( new ::comphelper::DocPasswordRequest( eType, css::task::PasswordRequestMode_PASSWORD_CREATE, aURL, bool( pCurrentFilter->GetFilterFlags() & SfxFilterFlags::PASSWORDTOMODIFY ) ) );
uno::Reference< css::task::XInteractionRequest > rRequest( pPasswordRequest.get() );
- do {
+ do
+ {
xInteractionHandler->handle( rRequest );
- if (pPasswordRequest->isPassword() && !bMSType)
+ if (!pPasswordRequest->isPassword() || bMSType)
{
- OString const utf8Pwd(OUStringToOString(pPasswordRequest->getPassword(), RTL_TEXTENCODING_UTF8));
- OString const utf8Ptm(OUStringToOString(pPasswordRequest->getPasswordToModify(), RTL_TEXTENCODING_UTF8));
- if (!(52 <= utf8Pwd.getLength() && utf8Pwd.getLength() <= 55
- && SvtSaveOptions().GetODFDefaultVersion() < SvtSaveOptions::ODFVER_012)
- && !(52 <= utf8Ptm.getLength() && utf8Ptm.getLength() <= 55))
- {
- break;
- }
- ScopedVclPtrInstance<MessBox>(Application::GetDefDialogParent(),
- MessBoxStyle::Ok, 0, "Password length",
- "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes."
- )->Execute();
-
+ break;
}
- } while (true);
+ OString const utf8Pwd(OUStringToOString(pPasswordRequest->getPassword(), RTL_TEXTENCODING_UTF8));
+ OString const utf8Ptm(OUStringToOString(pPasswordRequest->getPasswordToModify(), RTL_TEXTENCODING_UTF8));
+ if (!(52 <= utf8Pwd.getLength() && utf8Pwd.getLength() <= 55
+ && SvtSaveOptions().GetODFDefaultVersion() < SvtSaveOptions::ODFVER_012)
+ && !(52 <= utf8Ptm.getLength() && utf8Ptm.getLength() <= 55))
+ {
+ break;
+ }
+ ScopedVclPtrInstance<MessBox>(Application::GetDefDialogParent(),
+ MessBoxStyle::Ok, 0, "Password length",
+ "The password you have entered causes interoperability issues. Please enter a password that is shorter than 52 bytes, or longer than 55 bytes."
+ )->Execute();
+ }
+ while (true);
if ( pPasswordRequest->isPassword() )
{
if ( pPasswordRequest->getPassword().getLength() )