OLD | NEW |
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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1978 | 1978 |
1979 // Overflow is still possible for evil user inputs. | 1979 // Overflow is still possible for evil user inputs. |
1980 for (size_t i = 0; i <= size; ++i) { | 1980 for (size_t i = 0; i <= size; ++i) { |
1981 // The string should be composed of only digits and commas. | 1981 // The string should be composed of only digits and commas. |
1982 if (i != size && !IsAsciiDigit(allowed_ports[i]) && | 1982 if (i != size && !IsAsciiDigit(allowed_ports[i]) && |
1983 (allowed_ports[i] != kComma)) | 1983 (allowed_ports[i] != kComma)) |
1984 return; | 1984 return; |
1985 if (i == size || allowed_ports[i] == kComma) { | 1985 if (i == size || allowed_ports[i] == kComma) { |
1986 if (i > last) { | 1986 if (i > last) { |
1987 int port; | 1987 int port; |
1988 base::StringToInt(allowed_ports.begin() + last, | 1988 base::StringToInt(base::StringPiece(allowed_ports.begin() + last, |
1989 allowed_ports.begin() + i, | 1989 allowed_ports.begin() + i), |
1990 &port); | 1990 &port); |
1991 ports.insert(port); | 1991 ports.insert(port); |
1992 } | 1992 } |
1993 last = i + 1; | 1993 last = i + 1; |
1994 } | 1994 } |
1995 } | 1995 } |
1996 g_explicitly_allowed_ports.Get() = ports; | 1996 g_explicitly_allowed_ports.Get() = ports; |
1997 } | 1997 } |
1998 | 1998 |
1999 ScopedPortException::ScopedPortException(int port) : port_(port) { | 1999 ScopedPortException::ScopedPortException(int port) : port_(port) { |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 | 2454 |
2455 NetworkInterface::NetworkInterface(const std::string& name, | 2455 NetworkInterface::NetworkInterface(const std::string& name, |
2456 const IPAddressNumber& address) | 2456 const IPAddressNumber& address) |
2457 : name(name), address(address) { | 2457 : name(name), address(address) { |
2458 } | 2458 } |
2459 | 2459 |
2460 NetworkInterface::~NetworkInterface() { | 2460 NetworkInterface::~NetworkInterface() { |
2461 } | 2461 } |
2462 | 2462 |
2463 } // namespace net | 2463 } // namespace net |
OLD | NEW |