From 285af32010e97f9ee5c5efc4a028cc9956726d98 Mon Sep 17 00:00:00 2001 From: chanywa Date: Fri, 2 Jun 2017 14:33:12 +0900 Subject: [PATCH] Fix svace issue Change-Id: Iff8449a760f4a8954a51986b01b2cea2e80266ba --- src/mapzen/mapzen_restcurl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mapzen/mapzen_restcurl.c b/src/mapzen/mapzen_restcurl.c index 05547aa..9fa7e6a 100644 --- a/src/mapzen/mapzen_restcurl.c +++ b/src/mapzen/mapzen_restcurl.c @@ -66,6 +66,7 @@ static void __show_url_log(const char *url) { char urlLog[1024] = {}, *tmp = NULL; int url_index = 0, urlLog_index = 0; + const int bufferSize = sizeof(urlLog); if (!url) return; tmp = strstr(url, "api_key="); @@ -89,7 +90,7 @@ static void __show_url_log(const char *url) } urlLog_index = urlLog_index + 9; } - for (; url_index < strlen(url); url_index++, urlLog_index++) + for (; url_index < strlen(url) && url_index < bufferSize && urlLog_index < bufferSize; url_index++, urlLog_index++) urlLog[urlLog_index] = url[url_index]; MAP_DEBUG("HTTP URL [%s]", urlLog); } -- 2.7.4