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

Side by Side Diff: remoting/host/setup/me2me_native_messaging_host.cc

Issue 615543004: Fix remoting NM hosts to verify that incoming messages are dictionaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « remoting/host/native_messaging/pipe_messaging_channel.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/setup/me2me_native_messaging_host.h" 5 #include "remoting/host/setup/me2me_native_messaging_host.h"
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DCHECK(!quit_closure.is_null()); 97 DCHECK(!quit_closure.is_null());
98 98
99 quit_closure_ = quit_closure; 99 quit_closure_ = quit_closure;
100 100
101 channel_->Start(this); 101 channel_->Start(this);
102 } 102 }
103 103
104 void Me2MeNativeMessagingHost::OnMessage(scoped_ptr<base::Value> message) { 104 void Me2MeNativeMessagingHost::OnMessage(scoped_ptr<base::Value> message) {
105 DCHECK(thread_checker_.CalledOnValidThread()); 105 DCHECK(thread_checker_.CalledOnValidThread());
106 106
107 if (message->GetType() != base::Value::TYPE_DICTIONARY) {
108 LOG(ERROR) << "Received a message that's not a dictionary.";
109 channel_->SendMessage(nullptr);
110 return;
111 }
112
107 scoped_ptr<base::DictionaryValue> message_dict( 113 scoped_ptr<base::DictionaryValue> message_dict(
108 static_cast<base::DictionaryValue*>(message.release())); 114 static_cast<base::DictionaryValue*>(message.release()));
109 scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue()); 115 scoped_ptr<base::DictionaryValue> response(new base::DictionaryValue());
110 116
111 // If the client supplies an ID, it will expect it in the response. This 117 // If the client supplies an ID, it will expect it in the response. This
112 // might be a string or a number, so cope with both. 118 // might be a string or a number, so cope with both.
113 const base::Value* id; 119 const base::Value* id;
114 if (message_dict->Get("id", &id)) 120 if (message_dict->Get("id", &id))
115 response->Set("id", id->DeepCopy()); 121 response->Set("id", id->DeepCopy());
116 122
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 711
706 bool Me2MeNativeMessagingHost::DelegateToElevatedHost( 712 bool Me2MeNativeMessagingHost::DelegateToElevatedHost(
707 scoped_ptr<base::DictionaryValue> message) { 713 scoped_ptr<base::DictionaryValue> message) {
708 NOTREACHED(); 714 NOTREACHED();
709 return false; 715 return false;
710 } 716 }
711 717
712 #endif // !defined(OS_WIN) 718 #endif // !defined(OS_WIN)
713 719
714 } // namespace remoting 720 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/native_messaging/pipe_messaging_channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698