Skip to content

Commit

Permalink
http_client: use strcpy() instead of strncpy() with sizeof dest buffer
Browse files Browse the repository at this point in the history
- padding the rest of dest buffer with 0 is inneficient

(cherry picked from commit 9fe84d4)
  • Loading branch information
miconda committed Aug 30, 2017
1 parent 0bec6b3 commit a142db9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/modules/http_client/functions.c
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit a142db9

Please sign in to comment.