Title: [219561] trunk/Source/_javascript_Core
Revision
219561
Author
mcatanz...@igalia.com
Date
2017-07-17 08:30:59 -0700 (Mon, 17 Jul 2017)

Log Message

-Wformat-truncation warning in ConfigFile.cpp
https://bugs.webkit.org/show_bug.cgi?id=174506

Reviewed by Darin Adler.

Check if the JSC config filename would be truncated due to exceeding max path length. If so,
return ParseError.

* runtime/ConfigFile.cpp:
(JSC::ConfigFile::parse):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (219560 => 219561)


--- trunk/Source/_javascript_Core/ChangeLog	2017-07-17 15:16:54 UTC (rev 219560)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-07-17 15:30:59 UTC (rev 219561)
@@ -1,3 +1,16 @@
+2017-07-17  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        -Wformat-truncation warning in ConfigFile.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=174506
+
+        Reviewed by Darin Adler.
+
+        Check if the JSC config filename would be truncated due to exceeding max path length. If so,
+        return ParseError.
+
+        * runtime/ConfigFile.cpp:
+        (JSC::ConfigFile::parse):
+
 2017-07-17  Konstantin Tokarev  <annu...@yandex.ru>
 
         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called

Modified: trunk/Source/_javascript_Core/runtime/ConfigFile.cpp (219560 => 219561)


--- trunk/Source/_javascript_Core/runtime/ConfigFile.cpp	2017-07-17 15:16:54 UTC (rev 219560)
+++ trunk/Source/_javascript_Core/runtime/ConfigFile.cpp	2017-07-17 15:30:59 UTC (rev 219561)
@@ -282,9 +282,11 @@
         char* filename = nullptr;
         if (scanner.tryConsume('=') && (filename = scanner.tryConsumeString())) {
             if (statementNesting != NestedStatementFailedCriteria) {
-                if (filename[0] != '/')
-                    snprintf(logPathname, s_maxPathLength + 1, "%s/%s", m_configDirectory, filename);
-                else
+                if (filename[0] != '/') {
+                    int spaceRequired = snprintf(logPathname, s_maxPathLength + 1, "%s/%s", m_configDirectory, filename);
+                    if (static_cast<unsigned>(spaceRequired) > s_maxPathLength)
+                        return ParseError;
+                } else
                     strncpy(logPathname, filename, s_maxPathLength);
             }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to