diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 6e52c2db8e..a2ab31a202 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -28,7 +28,7 @@ conf_dir="../conf" lang_dir="../conf/vanilla/lang" fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." -supported_debian_distros="wheezy jessie stretch sid" +supported_debian_distros="wheezy jessie stretch buster sid" supported_ubuntu_distros="trusty utopic xenial" supported_distros="$supported_debian_distros $supported_ubuntu_distros" avoid_mods=( diff --git a/debian/control-modules b/debian/control-modules index ba9dda7806..2d8bbc27ce 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -479,6 +479,7 @@ Module: endpoints/mod_verto Description: Adds mod_verto. Adds mod_verto. Build-Depends: libperl-dev +Build-Depends-Buster: libperl-dev, libgdbm-compat-dev ## mod/event_handlers @@ -635,7 +636,7 @@ Description: Adds mod_basic. Module: languages/mod_java Description: mod_java Adds mod_java. -Build-Depends: default-jdk, gcj-jdk +Build-Depends: default-jdk Module: languages/mod_lua Description: mod_lua @@ -651,6 +652,7 @@ Module: languages/mod_perl Description: mod_perl Adds mod_perl. Build-Depends: libperl-dev +Build-Depends-Buster: libperl-dev, libgdbm-compat-dev Module: languages/mod_python Description: mod_python diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 609d9e2e00..a77ce01575 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -50,7 +50,7 @@ static unsigned char esl_console_complete(const char *buffer, const char *cursor #endif typedef struct { - char name[128]; + char name[256]; char host[128]; esl_port_t port; char user[256]; @@ -1267,7 +1267,7 @@ static void read_config(const char *dft_cfile, const char *cfile) { if (esl_config_open_file(&cfg, cfile) || esl_config_open_file(&cfg, dft_cfile)) { char *var, *val; - char cur_cat[128] = ""; + char cur_cat[256] = ""; while (esl_config_next_pair(&cfg, &var, &val)) { if (strcmp(cur_cat, cfg.category)) { esl_set_string(cur_cat, cfg.category); @@ -1470,7 +1470,7 @@ int main(int argc, char *argv[]) int argv_error = 0; int argv_exec = 0; char argv_command[1024] = ""; - char argv_loglevel[128] = ""; + char argv_loglevel[127] = ""; int argv_log_uuid = 0; int argv_log_uuid_short = 0; int argv_quiet = 0; diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 3f00a209f9..923ae966f4 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -1399,7 +1399,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ hval = esl_event_get_header(revent, "reply-text"); if (!esl_strlen_zero(hval)) { - strncpy(handle->last_reply, hval, sizeof(handle->last_reply)); + snprintf(handle->last_reply, sizeof(handle->last_reply), "%s", hval); } hval = esl_event_get_header(revent, "content-type"); @@ -1597,7 +1597,7 @@ ESL_DECLARE(esl_status_t) esl_send_recv_timed(esl_handle_t *handle, const char * hval = esl_event_get_header(handle->last_sr_event, "reply-text"); if (!esl_strlen_zero(hval)) { - strncpy(handle->last_sr_reply, hval, sizeof(handle->last_sr_reply)); + snprintf(handle->last_sr_reply, sizeof(handle->last_sr_reply), "%s", hval); } } } diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 0904b18030..4d2baac871 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -40,8 +40,8 @@ extern "C" { #endif /* defined(__cplusplus) */ -#define esl_copy_string(_x, _y, _z) strncpy(_x, _y, _z - 1) -#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x)) +#define esl_copy_string(_x, _y, _z) snprintf(_x, _z, "%s", _y) +#define esl_set_string(_x, _y) esl_copy_string(_x, _y, sizeof(_x)) #define ESL_VA_NONE "%s", "" typedef struct esl_event_header esl_event_header_t; diff --git a/libs/esl/src/include/esl_config.h b/libs/esl/src/include/esl_config.h index 03bbe9719b..44a485895b 100644 --- a/libs/esl/src/include/esl_config.h +++ b/libs/esl/src/include/esl_config.h @@ -113,7 +113,7 @@ struct esl_config { /*! FILE stream buffer to the opened file */ FILE *file; /*! path to the file */ - char path[512]; + char path[1024]; /*! current category */ char category[256]; /*! current section */ diff --git a/libs/miniupnpc/minissdpc.c b/libs/miniupnpc/minissdpc.c index 0bea0188d2..aa939fb7fb 100644 --- a/libs/miniupnpc/minissdpc.c +++ b/libs/miniupnpc/minissdpc.c @@ -58,7 +58,7 @@ getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath) return NULL; } addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path)); + memcpy(addr.sun_path, socketpath, sizeof(addr.sun_path)); if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) { /*syslog(LOG_WARNING, "connect(\"%s\"): %m", socketpath);*/ diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_strdup.c b/libs/sofia-sip/libsofia-sip-ua/su/su_strdup.c index 773f938449..6d5c59dc8f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_strdup.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_strdup.c @@ -34,6 +34,7 @@ #include "config.h" #include +#include #include "sofia-sip/su_alloc.h" /** Duplicate a string, allocate memory from @a home. @@ -54,7 +55,7 @@ char *su_strdup(su_home_t *home, char const *s) size_t n = strlen(s); char *retval = su_alloc(home, n + 1); if (retval) - strncpy(retval, s, n)[n] = 0; + snprintf(retval, n + 1, "%s", s); return retval; } return NULL; diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index cb78bb2c13..005378d392 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -111,10 +111,6 @@ typedef int gid_t; #include #define strcasecmp(s1, s2) stricmp(s1, s2) #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif - #else /* packed attribute */ #if (defined __SUNPRO_CC) || defined(__SUNPRO_C) diff --git a/src/mod/applications/mod_redis/credis.c b/src/mod/applications/mod_redis/credis.c index 0eba45dafa..61467f2776 100644 --- a/src/mod/applications/mod_redis/credis.c +++ b/src/mod/applications/mod_redis/credis.c @@ -35,9 +35,6 @@ #ifdef _MSC_VER #include #include -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif typedef SOCKET credis_socket_t; #define CREDIS_SOCK_INVALID INVALID_SOCKET #else diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index ad2b15b3d3..b07b87384d 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -302,7 +302,7 @@ static ks_status_t mod_signalwire_adoption_post(void) status = KS_STATUS_FAIL; goto done; } - strncpy(globals.adoption_data_external_ip, external_ip, sizeof(globals.adoption_data_external_ip)); + snprintf(globals.adoption_data_external_ip, sizeof(globals.adoption_data_external_ip), "%s", external_ip); } if (!globals.adoption_data_uname[0]) { @@ -609,7 +609,7 @@ static switch_status_t mod_signalwire_load_or_generate_token(void) token[len - 1] = '\0'; } - strncpy(globals.adoption_token, token, sizeof(globals.adoption_token) - 1); + snprintf(globals.adoption_token, sizeof(globals.adoption_token), "%s", token); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, @@ -674,7 +674,7 @@ static switch_status_t load_config() } if ((data = getenv("SW_ADOPTION_SERVICE"))) { - strncpy(globals.adoption_service, data, sizeof(globals.adoption_service)); + snprintf(globals.adoption_service, sizeof(globals.adoption_service), "%s", data); } swclt_config_load_from_env(globals.config); @@ -1032,7 +1032,7 @@ static void mod_signalwire_state_online(void) static void mod_signalwire_state_configure(void) { switch_memory_pool_t *pool = NULL; - char local_ip[256]; + char local_ip[64]; switch_port_t local_port = 6050; char local_endpoint[256]; char *external_ip; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0da976608d..46e2990614 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5760,7 +5760,7 @@ void general_event_handler(switch_event_t *event) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s] [%s]->[%s]\n", old_ip4, new_ip4, old_ip6, new_ip6); - strncpy(mod_sofia_globals.guess_ip, new_ip4, sizeof(mod_sofia_globals.guess_ip)); + snprintf(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), "%s", new_ip4); switch_mutex_lock(mod_sofia_globals.hash_mutex); if (mod_sofia_globals.profile_hash) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index c8b358b8a9..d8c6f510e9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2412,7 +2412,7 @@ void sofia_reg_handle_sip_r_register(int status, if (de && de->data && de->data->e_msg) { if (!zstr_buf(gateway->register_network_ip)) { - strncpy(oregister_network_ip, gateway->register_network_ip, sizeof(oregister_network_ip) - 1); + snprintf(oregister_network_ip, sizeof(oregister_network_ip), "%s", gateway->register_network_ip); } sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &gateway->register_network_port); if (!zstr_buf(network_ip)) { diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.h b/src/mod/endpoints/mod_verto/mcast/mcast.h index ace34fe7bc..75fa0d173b 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.h +++ b/src/mod/endpoints/mod_verto/mcast/mcast.h @@ -56,9 +56,6 @@ extern "C" { #ifndef strncasecmp #define strncasecmp _strnicmp #endif -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif #ifdef _WIN64 #define WS_SSIZE_T __int64 #elif _MSC_VER >= 1400 diff --git a/src/mod/endpoints/mod_verto/ws.h b/src/mod/endpoints/mod_verto/ws.h index 58bbaee316..84127cfb2c 100644 --- a/src/mod/endpoints/mod_verto/ws.h +++ b/src/mod/endpoints/mod_verto/ws.h @@ -40,9 +40,6 @@ #ifndef strncasecmp #define strncasecmp _strnicmp #endif -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif #ifdef _WIN64 #define WS_SSIZE_T __int64 #elif _MSC_VER >= 1400 diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c index d61a1054ac..f798d027b7 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_commands.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_commands.c @@ -333,8 +333,7 @@ static size_t header_callback(char *buffer, size_t size, size_t nitems, void *us int len = strlen(buffer); char buf[1024]; if(len > 2 && len < 1024) { - strncpy(buf, buffer, len-2); - buf[len-2] = '\0'; + snprintf(buf, sizeof(buf), "%s", buffer); switch_event_add_header_string(event, SWITCH_STACK_PUSH | SWITCH_STACK_BOTTOM, "Reply-Headers", buf); } return nitems * size; diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index d8e0692fd0..98f05898ad 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -252,7 +252,7 @@ static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, const char *tz = switch_channel_get_variable(channel, "timezone"); int mod_min; - char buffer[3]; + char buffer[11]; if (say_args->type == SST_TIME_MEASUREMENT) { diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h index 4c9e471402..eda49b20e7 100644 --- a/src/mod/xml_int/mod_xml_rpc/ws.h +++ b/src/mod/xml_int/mod_xml_rpc/ws.h @@ -13,9 +13,6 @@ #include #else #pragma warning(disable:4996) -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif #endif #include #include diff --git a/src/switch_core_db.c b/src/switch_core_db.c index d89fbdd487..14fb2f09ea 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -39,7 +39,7 @@ static void db_pick_path(const char *dbname, char *buf, switch_size_t size) { memset(buf, 0, size); if (switch_is_file_path(dbname)) { - strncpy(buf, dbname, size); + strncpy(buf, dbname, size-1); } else { switch_snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname); } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 10df7fbc9e..f34613870f 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -11921,7 +11921,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) memcpy(q, strchr(a_engine->adv_sdp_ip, ':') ? "6 " : "4 ", 2); p +=2; q +=2; - strncpy(q, a_engine->adv_sdp_ip, strlen(a_engine->adv_sdp_ip)); + snprintf(q, qe - q, "%s", a_engine->adv_sdp_ip); q += strlen(a_engine->adv_sdp_ip); while (p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'A' && *p <= 'F') || (*p >= 'a' && *p <= 'f'))) { @@ -11967,7 +11967,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) snprintf(o_line, sizeof(o_line), "o=%s %010u %010u IN %s %s\r\n", smh->mparams->sdp_username, smh->owner_id, smh->session_id, family, smh->mparams->sipip); - strncpy(q, o_line, strlen(o_line)); + snprintf(q, qe-q, "%s", o_line); q += strlen(o_line) - 1; } @@ -11988,8 +11988,8 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) p += len; snprintf(s_line, sizeof(s_line), "s=%s\r\n", smh->mparams->sdp_username); + snprintf(q, qe-q, "%s", s_line); - strncpy(q, s_line, strlen(s_line)); q += strlen(s_line) - 1; } @@ -12012,7 +12012,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } - strncpy(q, port_buf, strlen(port_buf)); + snprintf(q, qe - q, "%s", port_buf); q += strlen(port_buf); if (q >= qe) { @@ -12074,7 +12074,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) goto end; } - strncpy(q, vport_buf, strlen(vport_buf)); + snprintf(q, qe-q, "%s", vport_buf); q += strlen(vport_buf); if (q >= qe) { @@ -12137,7 +12137,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) goto end; } - strncpy(q, tport_buf, strlen(tport_buf)); + snprintf(q, qe-q, "%s", tport_buf); q += strlen(tport_buf); if (q >= qe) { diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c73abc47b9..0a2e732cda 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -4160,7 +4160,7 @@ SWITCH_DECLARE(void) switch_cache_db_status(switch_stream_handle_t *stream) } } if (i == 3) { - strncpy(cleankey_str, dbh->name, strlen(dbh->name)); + snprintf(cleankey_str, sizeof(cleankey_str), "%s", dbh->name); } count++; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 908ca2e8aa..8063d5cb10 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2711,11 +2711,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session memset(tmp, 0, mylen); tp = tmp; for (p = text; p && *p; p++) { - if (*p == '*') { - strncat(tp, star, starlen); + if (*p == '*' ) { + snprintf(tp + strlen(tp), sizeof(tp) - strlen(tp), "%s", star); tp += starlen; } else if (*p == '#') { - strncat(tp, pound, poundlen); + snprintf(tp + strlen(tp), sizeof(tp) - strlen(tp), "%s", pound); tp += poundlen; } else { *tp++ = *p; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 491bf16583..e8f2564b7e 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -157,7 +157,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable { switch_event_t *event; int *event_num = NULL; - char str_event_num[10]; + char str_event_num[12]; void *val; int added = 0; diff --git a/src/switch_nat.c b/src/switch_nat.c index 93742bf3fd..5b3fa5d543 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -427,7 +427,7 @@ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t m switch_core_set_variable("nat_public_addr", nat_globals.pub_addr); switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr); switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); - strncpy(nat_globals.nat_type_str, nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", sizeof(nat_globals.nat_type_str) - 1); + strncpy(nat_globals.nat_type_str, nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", sizeof(nat_globals.nat_type_str)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s, ExtIP: '%s'\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", nat_globals.pub_addr);