From: Daniel-Constantin Mierla Date: Fri, 28 Jul 2017 07:31:16 +0000 (+0200) Subject: http_client: use strcpy() instead of strncpy() with sizeof dest buffer X-Git-Tag: 5.1.0~729 X-Git-Url: http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commitdiff_plain;h=9fe84d4ad1ec1eae6bcf44b4067b948d9a16e4dc http_client: use strcpy() instead of strncpy() with sizeof dest buffer - padding the rest of dest buffer with 0 is inneficient --- diff --git a/src/modules/http_client/functions.c b/src/modules/http_client/functions.c index c4fc39d6a4..1bdae25df7 100644 --- a/src/modules/http_client/functions.c +++ b/src/modules/http_client/functions.c @@ -344,16 +344,14 @@ static int curL_query_url(struct sip_msg* _m, const char* _url, str* _dst, LM_DBG("We received Content-Type: %s\n", ct); if (params->pconn && strlen(ct)pconn->result_content_type)-1) { - strncpy(params->pconn->result_content_type, ct, - sizeof(params->pconn->result_content_type)); + strcpy(params->pconn->result_content_type, ct); } } if(url) { LM_DBG("We visited URL: %s\n", url); if (params->pconn && strlen(url)pconn->redirecturl)-1) { - strncpy(params->pconn->redirecturl, url , - sizeof(params->pconn->redirecturl)); + strcpy(params->pconn->redirecturl, url); } } }