aboutsummaryrefslogtreecommitdiff
path: root/client_shared.c
diff options
context:
space:
mode:
authorV.Krishn <vkrishn4@gmail.com>2019-12-04 10:07:36 +0530
committerV.Krishn <vkrishn4@gmail.com>2019-12-04 10:07:36 +0530
commit1dd04ff678fe022b8379d49c8a45bfccc5b75f87 (patch)
treecaaff0aa9149f6a98d4daff79f669bb6f4581f9a /client_shared.c
parent7d1da9dd59dc9dadc0944fb443eb39efa2c7e602 (diff)
downloadmqtt-dirpub-1dd04ff678fe022b8379d49c8a45bfccc5b75f87.tar.bz2
update to mosquitto-v1.6.2
Diffstat (limited to 'client_shared.c')
-rw-r--r--client_shared.c8
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")){