Sketcher: Ensure copy of temp string is kept

Coverity issue 545249. 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:18:51 -05:00
committed by Benjamin Nauck
parent 1c3f643420
commit a95e355c9a

View File

@@ -95,8 +95,8 @@ private:
}
if (file.hasExtension("skf")) {
auto filename = file.fileNamePure().c_str();
auto* pcFeature = pcDoc->addObject<Sketcher::SketchObjectSF>(filename);
auto filename = file.fileNamePure();
auto* pcFeature = pcDoc->addObject<Sketcher::SketchObjectSF>(filename.c_str());
pcFeature->SketchFlatFile.setValue(EncodedName.c_str());
pcDoc->recompute();