Changeset 126089 in webkit
- Timestamp:
- Aug 20, 2012 4:39:39 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r126079 r126089 1 2012-08-20 Nate Chapin <japhet@chromium.org> 2 3 Unsafe vsprintf usage in TestNetscapePlugin 4 https://bugs.webkit.org/show_bug.cgi?id=94522 5 6 Reviewed by Adam Barth. 7 8 * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: 9 (pluginLogWithArguments): Using vsnprintf instead of vsprintf to ensure we don't overflow 10 the message buffer. 11 (testDocumentOpen): 12 (testWindowOpen): 13 1 14 2012-08-20 George Staikos <staikos@webkit.org> 2 15 -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
r124705 r126089 61 61 } 62 62 63 // Helper function which takes in the plugin window object for logging to the console object. This function supports variable64 // arguments.65 static void pluginLogWithWindowObjectVariableArgs(NPObject* windowObject, NPP instance, const char* format, ...)66 {67 va_list args;68 va_start(args, format);69 char message[2048] = "PLUGIN: ";70 vsprintf(message + strlen(message), format, args);71 va_end(args);72 73 pluginLogWithWindowObject(windowObject, instance, message);74 }75 76 63 void pluginLogWithArguments(NPP instance, const char* format, va_list args) 77 64 { 78 char message[2048] = "PLUGIN: "; 79 vsprintf(message + strlen(message), format, args); 65 const size_t messageBufferSize = 2048; 66 char message[messageBufferSize] = "PLUGIN: "; 67 int messageLength = sizeof("PLUGIN: ") - 1; 68 messageLength += vsnprintf(message + messageLength, messageBufferSize - 1 - messageLength, format, args); 69 message[messageLength] = '\0'; 80 70 81 71 NPObject* windowObject = 0; … … 937 927 } 938 928 939 pluginLogWithWindowObject VariableArgs(windowObject, npp, "DOCUMENT OPEN SUCCESS");929 pluginLogWithWindowObject(windowObject, npp, "PLUGIN: DOCUMENT OPEN SUCCESS"); 940 930 notifyTestCompletion(npp, result.value.objectValue); 941 931 browser->releaseobject(result.value.objectValue); … … 969 959 } 970 960 971 pluginLogWithWindowObject VariableArgs(windowObject, npp, "WINDOW OPEN SUCCESS");961 pluginLogWithWindowObject(windowObject, npp, "PLUGIN: WINDOW OPEN SUCCESS"); 972 962 notifyTestCompletion(npp, result.value.objectValue); 973 963 browser->releaseobject(result.value.objectValue);
Note: See TracChangeset
for help on using the changeset viewer.