From 7bd03074ae7362d8fffe5182529626a0b43a0ed1 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 16 Aug 2021 21:46:44 +0200 Subject: Resolves: tdf#96561 Include embedded null-characters while assembling CSV line ... instead of prematurely ending analysis and skipping the remainder that is still part of data read. Change-Id: I8f34bc9672e37f9c1c1ae81ddeba464360add7c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120555 Reviewed-by: Eike Rathke Tested-by: Jenkins --- sc/source/ui/docshell/impex.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sc/source/ui/docshell') diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index f64cf4b0e5e8..3a798b37e50e 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2516,8 +2516,17 @@ Label_RetryWithNewSep: while (!rStream.eof() && aStr.getLength() < nArbitraryLineLengthLimit) { const sal_Unicode * p = aStr.getStr() + nLastOffset; - while (*p) + const sal_Unicode * const pStop = aStr.getStr() + aStr.getLength(); + while (p < pStop) { + if (!*p) + { + // Skip embedded null-characters. They don't change + // anything and are handled at a higher level. + ++p; + continue; + } + if (nQuotes) { if (*p == cFieldQuote) -- cgit v1.2.3