Spreadsheet: Ensure copy of temp string is kept

Coverity issue 545269. A temporary string is constructed, and its address stored via c_str(). That pointer is then used after the string is destroyed. The fix is to store the std::string.
This commit is contained in:
Chris Hennes
2025-03-20 23:20:48 -05:00
committed by Benjamin Nauck
parent a95e355c9a
commit 05bba1ab42

View File

@@ -69,8 +69,8 @@ private:
{
try {
Base::FileInfo file(Name);
auto filename = file.fileNamePure().c_str();
auto* pcSheet = pcDoc->addObject<Spreadsheet::Sheet>(filename);
auto filename = file.fileNamePure();
auto* pcSheet = pcDoc->addObject<Spreadsheet::Sheet>(filename.c_str());
pcSheet->importFromFile(Name, '\t', '"', '\\');
pcSheet->execute();