From a95e355c9a07f55c3b7bc20fb0dba75c0e81828e Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Thu, 20 Mar 2025 23:18:51 -0500 Subject: [PATCH] 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. --- src/Mod/Sketcher/App/AppSketcherPy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/App/AppSketcherPy.cpp b/src/Mod/Sketcher/App/AppSketcherPy.cpp index 00a6d937cb..590cc013be 100644 --- a/src/Mod/Sketcher/App/AppSketcherPy.cpp +++ b/src/Mod/Sketcher/App/AppSketcherPy.cpp @@ -95,8 +95,8 @@ private: } if (file.hasExtension("skf")) { - auto filename = file.fileNamePure().c_str(); - auto* pcFeature = pcDoc->addObject(filename); + auto filename = file.fileNamePure(); + auto* pcFeature = pcDoc->addObject(filename.c_str()); pcFeature->SketchFlatFile.setValue(EncodedName.c_str()); pcDoc->recompute();