r24755 by jghali - Fix potential buffer overflow in ScPaths::windowsSpecialDir()

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 25 19:55:52 UTC 2021


Author: jghali
Date: Mon Oct 25 19:55:52 2021
New Revision: 24755

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24755
Log:
Fix potential buffer overflow in ScPaths::windowsSpecialDir()

Modified:
    trunk/Scribus/scribus/scpaths.cpp

Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24755&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp	(original)
+++ trunk/Scribus/scribus/scpaths.cpp	Mon Oct 25 19:55:52 2021
@@ -107,8 +107,8 @@
 	qDebug() << QString("scpaths: qtplugins=%1").arg(QApplication::libraryPaths().join(":"));
 
 #elif defined(_WIN32)
-	QFileInfo appInfo(qApp->applicationDirPath());
-	QString appPath = qApp->applicationDirPath();
+	QFileInfo appInfo(QCoreApplication::applicationDirPath());
+	QString appPath = QCoreApplication::applicationDirPath();
 	QString cleanAppPath = appInfo.canonicalFilePath();
 	if (!cleanAppPath.isEmpty())
 		appPath = cleanAppPath;
@@ -511,9 +511,9 @@
 	QString appData = windowsSpecialDir(CSIDL_APPDATA);
 	if (QDir(appData).exists())
 #ifdef APPLICATION_DATA_DIR
-	return (appData + "/" + APPLICATION_DATA_DIR + "/");
+		return (appData + "/" + APPLICATION_DATA_DIR + "/");
 #else
-	return (appData + "/Scribus/");
+		return (appData + "/Scribus/");
 #endif
 #endif
 
@@ -686,7 +686,7 @@
 {
 	QString qstr;
 #ifdef Q_OS_WIN32
-	WCHAR dir[256];
+	WCHAR dir[MAX_PATH];
 	if (SHGetSpecialFolderPathW(nullptr, dir, folder , false))
 	{
 		qstr = QString::fromUtf16((const unsigned short*) dir);




More information about the scribus-commit mailing list