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

Side by Side Diff: base/file_util_proxy.cc

Issue 7651002: Adding checks to guard against buffer overruns in QuotaFileIO::Write and base::FileUtilProxy::Write (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util_proxy.h" 5 #include "base/file_util_proxy.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 8
9 // TODO(jianli): Move the code from anonymous namespace to base namespace so 9 // TODO(jianli): Move the code from anonymous namespace to base namespace so
10 // that all of the base:: prefixes would be unnecessary. 10 // that all of the base:: prefixes would be unnecessary.
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 } 859 }
860 860
861 // static 861 // static
862 bool FileUtilProxy::Write( 862 bool FileUtilProxy::Write(
863 scoped_refptr<MessageLoopProxy> message_loop_proxy, 863 scoped_refptr<MessageLoopProxy> message_loop_proxy,
864 PlatformFile file, 864 PlatformFile file,
865 int64 offset, 865 int64 offset,
866 const char* buffer, 866 const char* buffer,
867 int bytes_to_write, 867 int bytes_to_write,
868 WriteCallback* callback) { 868 WriteCallback* callback) {
869 if (bytes_to_write <= 0)
870 return false;
869 return Start(FROM_HERE, message_loop_proxy, 871 return Start(FROM_HERE, message_loop_proxy,
870 new RelayWrite(file, offset, buffer, bytes_to_write, callback)); 872 new RelayWrite(file, offset, buffer, bytes_to_write, callback));
871 } 873 }
872 874
873 // static 875 // static
874 bool FileUtilProxy::Touch( 876 bool FileUtilProxy::Touch(
875 scoped_refptr<MessageLoopProxy> message_loop_proxy, 877 scoped_refptr<MessageLoopProxy> message_loop_proxy,
876 PlatformFile file, 878 PlatformFile file,
877 const base::Time& last_access_time, 879 const base::Time& last_access_time,
878 const base::Time& last_modified_time, 880 const base::Time& last_modified_time,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 918
917 // static 919 // static
918 bool FileUtilProxy::Flush( 920 bool FileUtilProxy::Flush(
919 scoped_refptr<MessageLoopProxy> message_loop_proxy, 921 scoped_refptr<MessageLoopProxy> message_loop_proxy,
920 PlatformFile file, 922 PlatformFile file,
921 StatusCallback* callback) { 923 StatusCallback* callback) {
922 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); 924 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback));
923 } 925 }
924 926
925 } // namespace base 927 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_proxy.h ('k') | ppapi/c/ppb_file_io.h » ('j') | ppapi/c/ppb_file_io.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698