From ab4a9fc1a08ee5977650547f5bd0818a9c600979 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 30 Jan 2015 15:53:57 +1100 Subject: [PATCH] Cope with client.reconnect listing port as a string instead of integer --- src/generator.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/generator.c b/src/generator.c index dca9a86e..69400880 100644 --- a/src/generator.c +++ b/src/generator.c @@ -815,6 +815,14 @@ static bool parse_reconnect(proxy_instance_t *proxi, json_t *val) new_url = json_string_value(json_array_get(val, 0)); new_port = json_integer_value(json_array_get(val, 1)); + /* See if we have an invalid entry listing port as a string instead of + * integer and handle that. */ + if (!new_port) { + const char *newport_string = json_string_value(json_array_get(val, 1)); + + if (newport_string) + sscanf(newport_string, "%d", &new_port); + } if (new_url && strlen(new_url) && new_port) { char *dot_pool, *dot_reconnect; int len;