mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-08 16:52:13 +08:00
Fix parsing of malformed socks urls.
This commit is contained in:
parent
166bc2c481
commit
41f5d1fd43
@ -816,6 +816,10 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
|
||||
if(have_auth){
|
||||
/* Have already seen a @ , so this must be of form
|
||||
* socks5h://username[:password]@host:port */
|
||||
if(host){
|
||||
/* Already seen a host, must be malformed. */
|
||||
goto cleanup;
|
||||
}
|
||||
len = i-start;
|
||||
host = malloc(len + 1);
|
||||
memcpy(host, &(str[start]), len);
|
||||
@ -849,6 +853,10 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url)
|
||||
}else{
|
||||
/* Haven't seen a : yet, so must be of form
|
||||
* socks5h://username@... */
|
||||
if(username){
|
||||
/* Already got a username, must be malformed. */
|
||||
goto cleanup;
|
||||
}
|
||||
len = i-start;
|
||||
username = malloc(len + 1);
|
||||
memcpy(username, &(str[start]), len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user