Check url size limit.

This commit is contained in:
David Baird
2013-11-12 18:41:43 -07:00
parent 33ca65e4e8
commit fc12f28312
+4
View File
@@ -364,6 +364,10 @@ easywsclient::WebSocket::pointer from_url(std::string url, bool useMask) {
char host[128]; char host[128];
int port; int port;
char path[128]; char path[128];
if (url.size() >= 128) {
fprintf(stderr, "ERROR: url size limit exceeded: %s\n", url.c_str());
return NULL;
}
if (false) { } if (false) { }
else if (sscanf(url.c_str(), "ws://%[^:/]:%d/%s", host, &port, path) == 3) { else if (sscanf(url.c_str(), "ws://%[^:/]:%d/%s", host, &port, path) == 3) {
} }