Skip to content

Commit

Permalink
Merge pull request #524 from xavigibert/fix-uri
Browse files Browse the repository at this point in the history
Fixed uri validator by checking its length.
  • Loading branch information
zaphoyd committed Feb 21, 2016
2 parents 9dc013a + a4a79f6 commit 8b672f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions websocketpp/uri.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,21 @@ class uri {
int state = 0;

it = uri_string.begin();
size_t uri_len = uri_string.length();

if (std::equal(it,it+6,"wss://")) {
if (uri_len >= 7 && std::equal(it,it+6,"wss://")) {
m_secure = true;
m_scheme = "wss";
it += 6;
} else if (std::equal(it,it+5,"ws://")) {
} else if (uri_len >= 6 && std::equal(it,it+5,"ws://")) {
m_secure = false;
m_scheme = "ws";
it += 5;
} else if (std::equal(it,it+7,"http://")) {
} else if (uri_len >= 8 && std::equal(it,it+7,"http://")) {
m_secure = false;
m_scheme = "http";
it += 7;
} else if (std::equal(it,it+8,"https://")) {
} else if (uri_len >= 9 && std::equal(it,it+8,"https://")) {
m_secure = true;
m_scheme = "https";
it += 8;
Expand Down

0 comments on commit 8b672f7

Please sign in to comment.