1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

proxy: allow use of at char in passwords

Applies to both http proxy and socks proxy

https://github.com/warmcat/libwebsockets/issues/1247
This commit is contained in:
Andy Green 2018-04-20 10:49:29 +08:00
parent 97e36d8901
commit 4c5138eade

View file

@ -1770,7 +1770,7 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)
if (!strncmp(proxy, "http://", 7))
proxy += 7;
p = strchr(proxy, '@');
p = strrchr(proxy, '@');
if (p) { /* auth is around */
if ((unsigned int)(p - proxy) > sizeof(authstring) - 1)
@ -1829,7 +1829,7 @@ lws_set_socks(struct lws_vhost *vhost, const char *socks)
vhost->socks_user[0] = '\0';
vhost->socks_password[0] = '\0';
p_at = strchr(socks, '@');
p_at = strrchr(socks, '@');
if (p_at) { /* auth is around */
if ((unsigned int)(p_at - socks) > (sizeof(user)
+ sizeof(password) - 2)) {