Changeset 164179 in webkit
- Timestamp:
- Feb 15, 2014 1:15:49 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r164172 r164179 1 2014-02-15 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> 2 3 [EFL][WK2] Stop calling mktemp(3). 4 https://bugs.webkit.org/show_bug.cgi?id=128826 5 6 Reviewed by Gyuyoung Kim. 7 8 mktemp(3) is an insecure function and should be avoided at all costs. 9 Replace its usage with mkdtemp(3): instead of just getting a file name 10 that is supposed to be random and unused, we now create a directory 11 with a random name and then put whatever files we need there with fixed 12 names. 13 14 * UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp: 15 (TEST_F): 16 * UIProcess/API/efl/tests/test_ewk2_download_job.cpp: 17 (TEST_F): 18 1 19 2014-02-15 Dan Bernstein <mitz@apple.com> 2 20 -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
r161139 r164179 23 23 #include "UnitTestUtils/EWK2UnitTestBase.h" 24 24 #include "UnitTestUtils/EWK2UnitTestServer.h" 25 #include <stdio.h> 25 26 #include <stdlib.h> 26 27 #include <unistd.h> … … 200 201 201 202 // Make sure we don't get notifications when loading setting an existing persistent storage 202 char textStorage1[] = "/tmp/txt-cookie.XXXXXX"; 203 ASSERT_TRUE(mktemp(textStorage1)); 204 char textStorage2[] = "/tmp/txt-cookie.XXXXXX"; 205 ASSERT_TRUE(mktemp(textStorage2)); 203 char storageDirectory[] = "/tmp/ewk2_cookie_manager-XXXXXX"; 204 ASSERT_TRUE(mkdtemp(storageDirectory)); 205 char textStorage1[64]; 206 snprintf(textStorage1, sizeof(textStorage1), "%s/txt-cookie1", storageDirectory); 207 char textStorage2[64]; 208 snprintf(textStorage2, sizeof(textStorage2), "%s/txt-cookie2", storageDirectory); 206 209 207 210 ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); … … 222 225 unlink(textStorage1); 223 226 unlink(textStorage2); 227 rmdir(storageDirectory); 224 228 } 225 229 … … 266 270 267 271 // Generate unique names for cookie storages. 268 char textStorage[] = "/tmp/txt-cookie.XXXXXX"; 269 ASSERT_TRUE(mktemp(textStorage)); 270 char sqliteStorage[] = "/tmp/sqlite-cookie.XXXXXX"; 271 ASSERT_TRUE(mktemp(sqliteStorage)); 272 char storageDirectory[] = "/tmp/ewk2_cookie_manager-XXXXXX"; 273 ASSERT_TRUE(mkdtemp(storageDirectory)); 274 char textStorage[64]; 275 snprintf(textStorage, sizeof(textStorage), "%s/txt-cookie", storageDirectory); 276 char sqliteStorage[64]; 277 snprintf(sqliteStorage, sizeof(sqliteStorage), "%s/sqlite-cookie", storageDirectory); 272 278 273 279 Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_view_context_get(webView())); … … 306 312 unlink(textStorage); 307 313 unlink(sqliteStorage); 314 rmdir(storageDirectory); 308 315 } -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp
r159190 r164179 30 30 #include <sys/stat.h> 31 31 #include <sys/types.h> 32 #include <stdio.h> 33 #include <stdlib.h> 32 34 #include <unistd.h> 33 35 … … 153 155 httpServer->run(serverCallback); 154 156 155 // Generate unique name for destination file. 156 char destinationPath[] = "/tmp/pdf-file.XXXXXX"; 157 ASSERT_TRUE(mktemp(destinationPath)); 157 CString fileUrl = httpServer->getURLForPath(testFilePath); 158 158 159 CString fileUrl = httpServer->getURLForPath(testFilePath); 159 char destinationDirectory[] = "/tmp/ewk2_download_job-XXXXXX"; 160 ASSERT_TRUE(mkdtemp(destinationDirectory)); 161 char destinationPath[64]; 162 snprintf(destinationPath, sizeof(destinationPath), "%s/pdf-file", destinationDirectory); 160 163 161 164 DownloadTestData userData = { fileUrl.data(), destinationPath }; … … 173 176 // Clean up 174 177 unlink(destinationPath); 178 rmdir(destinationDirectory); 175 179 }
Note: See TracChangeset
for help on using the changeset viewer.