http_client: use strcpy() instead of strncpy() with sizeof dest buffer
authorDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 28 Jul 2017 07:31:16 +0000 (09:31 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 28 Jul 2017 08:30:19 +0000 (10:30 +0200)
- padding the rest of dest buffer with 0 is inneficient

src/modules/http_client/functions.c

index c4fc39d..1bdae25 100644 (file)
@@ -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)<sizeof(params->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)<sizeof(params->pconn->redirecturl)-1) {
-                               strncpy(params->pconn->redirecturl, url ,
-                                               sizeof(params->pconn->redirecturl));
+                               strcpy(params->pconn->redirecturl, url);
                        }
                }
        }