diff options
author | Justin Luth <justin_luth@sil.org> | 2017-05-25 20:47:03 +0300 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-05-25 23:29:39 +0200 |
commit | b139bf96574010f317c543bc45d23dd6a5810621 (patch) | |
tree | 7500b749181e3835c61ad60a099830afa5cb76c4 /sc/source/filter/excel/xecontent.cxx | |
parent | 3721d9893e1f9e1c355f39f66e3f7e6e341c2cc0 (diff) |
tdf#99856 xlsx export: limit dataValidation list to 255 chars
Excel consider the file corrupt if it has an overly long
validation list.
Change-Id: I4145859d4f76e0a70521c7bee33c96927b437ace
Reviewed-on: https://gerrit.libreoffice.org/38038
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sc/source/filter/excel/xecontent.cxx')
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 81fe1e9a922b..4c5907c26f93 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1671,6 +1671,16 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : } ::set_flag( mnFlags, EXC_DV_STRINGLIST ); + // maximum length allowed in Excel is 255 characters, and don't end with an empty token + sal_uInt32 nLen = sFormulaBuf.getLength(); + if( nLen > 256 ) // 255 + beginning quote mark + { + nLen = 255; + if( sFormulaBuf[nLen - 1] == ',' ) + --nLen; + sFormulaBuf = sFormulaBuf.copy(0, nLen); + } + sFormulaBuf.append( '"' ); msFormula1 = sFormulaBuf.makeStringAndClear(); } |