summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:03:43 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:03:43 +0000
commit166a865e356b1841a1e3bf3b32bc5aaf13215f6e (patch)
tree6aeefbef7ebeb5eb1a232b6c88645da240d73a79 /printing
parent4cb7699e349fabe62f9b4af7894361c4334161f9 (diff)
downloadchromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.zip
chromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.tar.gz
chromium_src-166a865e356b1841a1e3bf3b32bc5aaf13215f6e.tar.bz2
Base: Remove Receive() from ScopedHandle.
In general, the OS API contract doesn't guarantee that output variables are not modified on failure, so a Reeceive pattern is fundamentally insecure. BUG=318531 TEST=current tests tbr'ing owners for the consumers. TBR=jvoung@chromium.org, thakis@chromium.org, sergeyu@chromium.org, grt@chromium.org, gene@chromium.org, youngki@chromium.org Review URL: https://codereview.chromium.org/71013004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/backend/win_helper.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/printing/backend/win_helper.h b/printing/backend/win_helper.h
index 0f6b7ef..db66bf8 100644
--- a/printing/backend/win_helper.h
+++ b/printing/backend/win_helper.h
@@ -46,9 +46,10 @@ class ScopedPrinterHandle
base::win::VerifierTraits> {
public:
bool OpenPrinter(const wchar_t* printer) {
+ HANDLE temp_handle;
// ::OpenPrinter may return error but assign some value into handle.
- if (!::OpenPrinter(const_cast<LPTSTR>(printer), Receive(), NULL)) {
- Take();
+ if (::OpenPrinter(const_cast<LPTSTR>(printer), &temp_handle, NULL)) {
+ Set(temp_handle);
}
return IsValid();
}
@@ -56,10 +57,6 @@ class ScopedPrinterHandle
private:
typedef base::win::GenericScopedHandle<PrinterHandleTraits,
base::win::VerifierTraits> Base;
- // Hide Receive to avoid assigning handle when ::OpenPrinter returned error.
- Base::Receiver Receive() {
- return Base::Receive();
- }
};
class PrinterChangeHandleTraits {