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

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

Issue 817103002: Only take basename of default_file_name when starting a File Chooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: POSIX fixes Created 5 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
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 190545d1e8e51920cee75acfffbcc953f2e05d7e..b5839aa2483aa1eb762220a4e028ff0e57f27db2 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1395,6 +1395,14 @@ void RenderViewHostImpl::OnDidZoomURL(double zoom_level,
}
void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) {
+ // Do not allow messages with absolute paths in them as this can permit a
+ // renderer to coerce the browser to perform I/O on a renderer controlled
+ // path.
+ if (params.default_file_name != params.default_file_name.BaseName()) {
+ GetProcess()->ReceivedBadMessage();
+ return;
+ }
+
delegate_->RunFileChooser(this, params);
}
« no previous file with comments | « no previous file | content/browser/security_exploit_browsertest.cc » ('j') | content/browser/security_exploit_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698