summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/protocol_parser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/safe_browsing/protocol_parser.cc')
-rw-r--r--chrome/browser/safe_browsing/protocol_parser.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/chrome/browser/safe_browsing/protocol_parser.cc b/chrome/browser/safe_browsing/protocol_parser.cc
index 168aee9..e9ca15a 100644
--- a/chrome/browser/safe_browsing/protocol_parser.cc
+++ b/chrome/browser/safe_browsing/protocol_parser.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -141,6 +141,12 @@ bool SafeBrowsingProtocolParser::ParseUpdate(
// Populated below.
std::string list_name;
+ // If we requested the MAC, the response must start with a MAC command.
+ // This test ensures it is present, the value will be verified in the
+ // switch statement below.
+ if (!key.empty() && (length < 1 || data[0] != 'm'))
+ return false;
+
while (length > 0) {
std::string cmd_line;
if (!GetLine(data, length, &cmd_line))