Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1932)

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 194099: Size the buffer used for the metrics log text properly.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 26002)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -405,7 +405,7 @@
server_permits_upload_(true),
state_(INITIALIZED),
pending_log_(NULL),
- pending_log_text_(""),
+ pending_log_text_(),
current_fetch_(NULL),
current_log_(NULL),
idle_since_last_transmission_(false),
@@ -1205,9 +1205,11 @@
DCHECK(pending_log());
if (!pending_log_text_.empty())
return;
- int original_size = pending_log_->GetEncodedLogSize();
- pending_log_->GetEncodedLog(WriteInto(&pending_log_text_, original_size),
- original_size);
+ int text_size = pending_log_->GetEncodedLogSize();
+
+ // Leave room for the NUL terminator.
+ pending_log_->GetEncodedLog(WriteInto(&pending_log_text_, text_size + 1),
+ text_size);
}
void MetricsService::PrepareFetchWithPendingLog() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698