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

Issue 194099: Size the buffer used for the metrics log text properly.... (Closed)

Created:
11 years, 3 months ago by Mark Mentovai
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, Ben Goodger (Google)
Visibility:
Public.

Description

Size the buffer used for the metrics log text properly. The existing code was abusing the WriteInto interface (base/string_util.h). The size passed to WriteInto should be the size of the string plus one for a terminating NUL byte. This bug caused the final newline in the log to be clipped. c_str users (there probably weren't any) would see the final newline which wouldn't be wouldn't be followed by a NUL byte. TEST=not really any BUG=21733 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=26280

Patch Set 1 #

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -4 lines) Patch
M chrome/browser/metrics/metrics_service.cc View 2 chunks +6 lines, -4 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Mark Mentovai
11 years, 3 months ago (2009-09-14 03:23:41 UTC) #1
Mark Mentovai
Jim, when you get a sec, could you review this simple change? I wrote: > ...
11 years, 3 months ago (2009-09-15 20:50:39 UTC) #2
jar (doing other things)
11 years, 3 months ago (2009-09-15 22:17:35 UTC) #3
I wasn't familiar with this code, but the change LGTM.

I'll try to look around in our codebase and see if this is happening elsewhere. 
I don't especially like the API, and suspect it is vulnerable to this class of
mistake elsewhere.

Powered by Google App Engine
This is Rietveld 408576698