Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/bindings.ipp

Issue 29404594: Noissue - [emscripten] Replace sprintf() usage by safe alternatives (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created April 6, 2017, 8:40 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | compiled/filter/ActiveFilter.cpp » ('j') | compiled/filter/ActiveFilter.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/bindings.ipp
===================================================================
--- a/compiled/bindings.ipp
+++ b/compiled/bindings.ipp
@@ -452,36 +452,35 @@ namespace bindings_internal
return result;
}
else
throw std::runtime_error("Unexpected return type for " + std::string(call.name));
}
const std::string wrapCall(const FunctionInfo& call)
{
- char buffer[20];
bool hasStringArgs = false;
std::vector<std::string> params;
std::string prefix = "function(";
for (int i = 0; i < call.args.size(); i++)
{
- sprintf(buffer, "arg%i", i);
+ std::string argName("arg" + std::to_string(i));
if (i > 0)
prefix += ", ";
- prefix += buffer;
+ prefix += argName;
if (call.args[i] == TypeCategory::STRING_REF)
{
hasStringArgs = true;
- params.push_back(std::string("createString(") + buffer + ")");
+ params.push_back(std::string("createString(") + argName + ")");
}
else if (call.args[i] == TypeCategory::CLASS_PTR)
- params.push_back(std::string(buffer) + "._pointer");
+ params.push_back(argName + "._pointer");
else
- params.push_back(buffer);
+ params.push_back(argName);
}
prefix += ")\n{\n";
std::string suffix = "}";
if (call.returnType != TypeCategory::VOID)
suffix = " return result;\n" + suffix;
if (call.returnType == TypeCategory::DEPENDENT_STRING ||
« no previous file with comments | « no previous file | compiled/filter/ActiveFilter.cpp » ('j') | compiled/filter/ActiveFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld