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

Unified Diff: content/browser/renderer_host/database_message_filter.cc

Issue 12212091: WebDatabase: check path traversal in origin_identifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more testcases Created 7 years, 10 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 | webkit/database/database_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/database_message_filter.cc
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc
index f8b0aa680c9f5148acb3713f0229c1e53a57837f..f364ce2f2c1a6772e5f86b646c08dd0de48117ba 100644
--- a/content/browser/renderer_host/database_message_filter.cc
+++ b/content/browser/renderer_host/database_message_filter.cc
@@ -284,6 +284,13 @@ void DatabaseMessageFilter::OnDatabaseOpened(const string16& origin_identifier,
const string16& description,
int64 estimated_size) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
+ if (!DatabaseUtil::IsValidOriginIdentifier(origin_identifier)) {
+ RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
+ BadMessageReceived();
+ return;
+ }
+
int64 database_size = 0;
db_tracker_->DatabaseOpened(origin_identifier, database_name, description,
estimated_size, &database_size);
@@ -325,6 +332,12 @@ void DatabaseMessageFilter::OnHandleSqliteError(
const string16& database_name,
int error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ if (!DatabaseUtil::IsValidOriginIdentifier(origin_identifier)) {
+ RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
+ BadMessageReceived();
+ return;
+ }
+
db_tracker_->HandleSqliteError(origin_identifier, database_name, error);
}
« no previous file with comments | « no previous file | webkit/database/database_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698