diff options
author | V.Krishn <vkrishn4@gmail.com> | 2019-12-04 10:07:36 +0530 |
---|---|---|
committer | V.Krishn <vkrishn4@gmail.com> | 2019-12-04 10:07:36 +0530 |
commit | 1dd04ff678fe022b8379d49c8a45bfccc5b75f87 (patch) | |
tree | caaff0aa9149f6a98d4daff79f669bb6f4581f9a /client_shared.c | |
parent | 7d1da9dd59dc9dadc0944fb443eb39efa2c7e602 (diff) | |
download | mqtt-dirpub-1dd04ff678fe022b8379d49c8a45bfccc5b75f87.tar.bz2 |
update to mosquitto-v1.6.2
Diffstat (limited to 'client_shared.c')
-rw-r--r-- | client_shared.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/client_shared.c b/client_shared.c index 4338d37..4f47937 100644 --- a/client_shared.c +++ b/client_shared.c @@ -698,13 +698,13 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c tmp = strchr(url, '@'); if(tmp) { - char *colon = strchr(url, ':'); *tmp++ = 0; + char *colon = strchr(url, ':'); if(colon) { *colon = 0; - cfg->password = colon + 1; + cfg->password = strdup(colon + 1); } - cfg->username = url; + cfg->username = strdup(url); url = tmp; } cfg->host = url; @@ -714,6 +714,8 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c *tmp++ = 0; cfg->port = atoi(tmp); } + /* Now we've removed the port, time to get the host on the heap */ + cfg->host = strdup(cfg->host); } i++; }else if(!strcmp(argv[i], "-l") || !strcmp(argv[i], "--stdin-line")){ |