From 30cbb8e8c19b5d10bce064565376b6067528963c Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 21 Feb 2014 09:46:55 +0800 Subject: [PATCH] fix #44 --- src/jconf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/jconf.c b/src/jconf.c index 92c482f4..510a55c6 100644 --- a/src/jconf.c +++ b/src/jconf.c @@ -45,14 +45,20 @@ void free_addr(addr_t *addr) void parse_addr(const char *str, addr_t *addr) { - int ret = -1; + int ret = -1, n = 0; char *pch; pch = strchr(str, ':'); while (pch != NULL) { + n++; ret = pch - str; pch = strchr(pch + 1, ':'); } + if (n > 1) { + if (strcmp(str+ret, "]") != 0) { + ret = -1; + } + } if (ret == -1) { addr->host = strdup(str);