diff options
author | Martin Hurton <hurtonm@gmail.com> | 2012-03-27 06:16:33 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-06 13:00:40 +0200 |
commit | 6c733a38308cc03f82ffb1e0d58f72d71460784f (patch) | |
tree | c2878b6802b9294c1a581fb99bcde86fe33bf56d /src | |
parent | a5fefa3d5ba405deedba689b056959358048d935 (diff) |
tcp_address: check address length before manipulating it
Diffstat (limited to 'src')
-rw-r--r-- | src/tcp_address.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index a82298d..ae69708 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -396,7 +396,7 @@ int xs::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_, addr_str = name_; // Remove square brackets around the address, if any. - if (!addr_str.empty () && addr_str [0] == '[' && + if (addr_str.size () >= 2 && addr_str [0] == '[' && addr_str [addr_str.size () - 1] == ']') addr_str = addr_str.substr (1, addr_str.size () - 2); |