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

Unified Diff: net/disk_cache/entry_impl.cc

Issue 8418034: Make string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
Index: net/disk_cache/entry_impl.cc
===================================================================
--- net/disk_cache/entry_impl.cc (revision 107404)
+++ net/disk_cache/entry_impl.cc (working copy)
@@ -773,11 +773,11 @@
File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address,
kKeyFileIndex);
- if (!offset && key_file->GetLength() != static_cast<size_t>(key_len + 1))
+ ++key_len; // We store a trailing \0 on disk that we read back below.
joth 2011/11/01 11:25:32 My reading of line 432 is we don't write the trail
rvargas (doing something else) 2011/11/01 18:13:48 The extra \0 on disk comes from lines 421 and 438.
joth 2011/11/01 19:14:51 Ah yes, thanks. Still - seems a bit funny this is
rvargas (doing something else) 2011/11/01 19:36:52 yes, that looks like an oversight. I think the ori
+ if (!offset && key_file->GetLength() != static_cast<size_t>(key_len))
return std::string();
- if (!key_file ||
- !key_file->Read(WriteInto(&key_, key_len + 1), key_len + 1, offset))
+ if (!key_file || !key_file->Read(WriteInto(&key_, key_len), key_len, offset))
key_.clear();
return key_;
}

Powered by Google App Engine
This is Rietveld 408576698