Skip to content
Snippets Groups Projects
Commit 16efbf49 authored by JoonCheol Park's avatar JoonCheol Park Committed by Andy Green
Browse files

socks5: fix remain dst buffer length when calls lws_strncpy

parent 9591d242
Branches
No related tags found
No related merge requests found
...@@ -1017,14 +1017,14 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type, ...@@ -1017,14 +1017,14 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
pt->serv_buf[len++] = n; pt->serv_buf[len++] = n;
/* user name */ /* user name */
lws_strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_user, lws_strncpy((char *)&pt->serv_buf[len], wsi->vhost->socks_user,
context->pt_serv_buf_size - len + 1); context->pt_serv_buf_size - len);
len += n; len += n;
/* length of the password */ /* length of the password */
pt->serv_buf[len++] = passwd_len; pt->serv_buf[len++] = passwd_len;
/* password */ /* password */
lws_strncpy((char *)&pt->serv_buf[len], lws_strncpy((char *)&pt->serv_buf[len],
wsi->vhost->socks_password, wsi->vhost->socks_password,
context->pt_serv_buf_size - len + 1); context->pt_serv_buf_size - len);
len += passwd_len; len += passwd_len;
break; break;
...@@ -1044,7 +1044,7 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type, ...@@ -1044,7 +1044,7 @@ void socks_generate_msg(struct lws *wsi, enum socks_msg_type type,
/* the address we tell SOCKS proxy to connect to */ /* the address we tell SOCKS proxy to connect to */
lws_strncpy((char *)&(pt->serv_buf[len]), wsi->stash->address, lws_strncpy((char *)&(pt->serv_buf[len]), wsi->stash->address,
context->pt_serv_buf_size - len + 1); context->pt_serv_buf_size - len);
len += strlen(wsi->stash->address); len += strlen(wsi->stash->address);
net_num = htons(wsi->c_port); net_num = htons(wsi->c_port);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment