summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/storagehelper.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/misc/storagehelper.cxx')
-rw-r--r--comphelper/source/misc/storagehelper.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index b00e8c543752..b0b7897fd2ab 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -566,10 +566,17 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat
bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed )
{
+ long nDots{0};
for ( size_t i = 0; i < aName.size(); i++ )
{
switch ( aName[i] )
{
+ case '.':
+ if (nDots != -1)
+ {
+ ++nDots;
+ }
+ break;
case '\\':
case '?':
case '<':
@@ -579,15 +586,17 @@ bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bS
case ':':
return false;
case '/':
- if ( !bSlashAllowed )
+ if (!bSlashAllowed || nDots == 1 || nDots == 2 || i == 0)
return false;
+ nDots = 0;
break;
default:
+ nDots = -1;
if ( aName[i] < 32 || (aName[i] >= 0xD800 && aName[i] <= 0xDFFF) )
return false;
}
}
- return true;
+ return nDots != 1 && nDots != 2;
}