diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ab5dbe..0ed6273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0...3.5) +cmake_minimum_required(VERSION 3.0...3.10) PROJECT(icwmp C) diff --git a/bbf_plugin/CMakeLists.txt b/bbf_plugin/CMakeLists.txt index 13a58f0..4fd6a4a 100644 --- a/bbf_plugin/CMakeLists.txt +++ b/bbf_plugin/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.0...3.5) - PROJECT(libcwmpdm.so) ADD_DEFINITIONS(-Wall -Werror -Wformat -g) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f555328..24f3320 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 3.0...3.5) - PROJECT(icwmpd) ADD_DEFINITIONS(-Wall -Werror -Wformat -g) diff --git a/src/http.c b/src/http.c index 15b52a0..94f9b22 100644 --- a/src/http.c +++ b/src/http.c @@ -38,7 +38,7 @@ static bool curl_glob_init = false; void http_set_timeout(void) { if (curl) - curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1L); } int icwmp_http_client_init() @@ -114,8 +114,8 @@ static void http_set_security_options() } if (cwmp_ctx.conf.insecure_enable) { - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)false); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); } if (CWMP_STRLEN(cwmp_ctx.conf.cpe_client_cert) != 0 && file_exists(cwmp_ctx.conf.cpe_client_cert) && @@ -134,8 +134,8 @@ static void http_set_connection_options() curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, 1L); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 5L); - curl_easy_setopt(curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); - curl_easy_setopt(curl, CURLOPT_NOBODY, 0); + curl_easy_setopt(curl, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL); + curl_easy_setopt(curl, CURLOPT_NOBODY, 0L); curl_easy_setopt(curl, CURLOPT_IPRESOLVE, cwmp_ctx.net.ip_resolve); @@ -259,7 +259,7 @@ static void http_set_inout_options(char *msg_out, int msg_out_len, char **msg_in if (msg_out) curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)msg_out_len); else - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, http_get_response); curl_easy_setopt(curl, CURLOPT_WRITEDATA, msg_in); @@ -500,7 +500,8 @@ static void http_cr_new_client(int client, bool service_available) */ size_t avail_space = (size_t)(sizeof(data) - strlen(data)); if (buf_len < avail_space) { - strncat(data, buffer, buf_len); + //strncat(data, buffer, buf_len); + snprintf(data+strlen(data), avail_space, "%s", buffer); } } diff --git a/src/http.h b/src/http.h index 166e3e0..7588eff 100644 --- a/src/http.h +++ b/src/http.h @@ -17,7 +17,7 @@ #include "common.h" -#define HTTP_TIMEOUT 60 +#define HTTP_TIMEOUT 60L void http_set_timeout(void); diff --git a/src/upload.c b/src/upload.c index a872917..7d89e83 100644 --- a/src/upload.c +++ b/src/upload.c @@ -126,9 +126,9 @@ static long upload_file(const char *file_path, const char *url, const char *user } if (CWMP_STRNCMP(url, "https://", 8) == 0) - curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)false); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, CURL_TIMEOUT); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)CURL_TIMEOUT); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);