Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions dwnlutils/urlHelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,27 @@ CURLcode setMtlsHeaders(CURL *curl, MtlsAuth_t *sec) {
return code;
}
COMMONUTILITIES_INFO("%s: certfile:%s:cert type:%s\n", __FUNCTION__, sec->cert_name, sec->cert_type);

#if 1
#ifdef LIBRDKCERTSELECTOR
COMMONUTILITIES_INFO("%s: engine type:%s\n", __FUNCTION__, sec->engine);
if (sec->engine[0] == '\0') {
code = curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
printf("DBG: Def : software engine \n");
}else{
code = curl_easy_setopt(curl, CURLOPT_SSLENGINE, sec->engine);
printf("DBG: ##### sec->engine (certselector condition success) ####### is %s \n", sec->engine);
}
// printf("DBG: ##### sec->engine (certselector) ####### is %s \n", sec->engine);
#else
code = curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1L);
#endif
printf("DBG: software engine \n");
#endif
#endif
printf("DBG: ##### Forcefully to set pkcs11 \n");
code = curl_easy_setopt(curl, CURLOPT_SSLENGINE, "pkcs11");
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverity Issue - Unchecked return value from library

Calling "curl_easy_setopt(curl, _curl_opt, 1L)" without checking return value. This library function may fail and return an error code.

Medium Impact, CWE-252
CHECKED_RETURN

if(code != CURLE_OK) {
COMMONUTILITIES_ERROR("%s : Curl CURLOPT_SSLENGINE_DEFAULT failed with error %s\n", __FUNCTION__, curl_easy_strerror(code));
COMMONUTILITIES_ERROR("%s : Curl ############# CURLOPT_SSLENGINE_DEFAULT failed with error %s\n", __FUNCTION__, curl_easy_strerror(code));
}
do {
if((strcmp(sec->cert_type, "P12")) == 0) {
Expand Down
Loading