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

Unified Diff: compiled/filter/ActiveFilter.cpp

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 | « compiled/bindings.ipp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/filter/ActiveFilter.cpp
===================================================================
--- a/compiled/filter/ActiveFilter.cpp
+++ b/compiled/filter/ActiveFilter.cpp
@@ -21,18 +21,19 @@
#include "../StringScanner.h"
namespace
{
const DependentString DEFAULT_DOMAIN(u""_str);
OwnedString to_string(unsigned int i)
{
- char buffer[11];
- int len = sprintf(buffer, "%u", i);
+ const std::size_t BUFFER_SIZE = 11;
+ char buffer[BUFFER_SIZE];
+ int len = snprintf(buffer, BUFFER_SIZE, "%u", i);
OwnedString result(len);
hub 2017/04/06 10:31:23 From `man snprintf`
Wladimir Palant 2017/04/06 15:14:40 We have the same issue in the subscription classes
for (String::size_type i = 0; i < len; i++)
result[i] = buffer[i];
return result;
}
}
« no previous file with comments | « compiled/bindings.ipp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld