From 052c7c306190643241b1c41faa8a7f5596200d1c Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Wed, 28 Jun 2017 06:10:46 -0600 Subject: [PATCH 1/4] FS-9785: Fix format-truncation warnings for systems that treat it as an error. --- libs/esl/fs_cli.c | 2 +- libs/freetdm/src/ftdm_io.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 237dc483c0..39c445ba5c 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -76,7 +76,7 @@ static int is_color = 1; static int warn_stop = 0; static int connected = 0; static int allow_ctl_c = 0; -static char bare_prompt_str[512] = ""; +static char bare_prompt_str[514] = ""; static int bare_prompt_str_len = 0; static char prompt_str[512] = ""; static char prompt_color[12] = {ESL_SEQ_DEFAULT_COLOR}; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c3570d780a..9adcd27509 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3817,7 +3817,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons if (!ftdmchan->dtmfdbg.file) { struct tm currtime; time_t currsec; - char dfile[1024]; + char dfile[1138]; currsec = time(NULL); @@ -5636,7 +5636,7 @@ FT_DECLARE(ftdm_status_t) ftdm_unload_modules(void) { ftdm_hash_iterator_t *i = NULL; ftdm_dso_lib_t lib = NULL; - char modpath[255] = { 0 }; + char modpath[256] = { 0 }; /* stop signaling interfaces first as signaling depends on I/O and not the other way around */ for (i = hashtable_first(globals.module_hash); i; i = hashtable_next(i)) { From c57c740c68c405bb9d2bdec60567736691c425da Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Wed, 28 Jun 2017 06:12:44 -0600 Subject: [PATCH 2/4] =?UTF-8?q?FS-9785:=20Fix=20src/switch=5Fivr=5Fplay=5F?= =?UTF-8?q?say.c:1668:48:=20error:=20=E2=80=98*=E2=80=99=20in=20boolean=20?= =?UTF-8?q?context,=20suggest=20=E2=80=98&&=E2=80=99=20instead=20[-Werror?= =?UTF-8?q?=3Dint-in-bool-context]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/switch_ivr_play_say.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index d4f0d46c80..6a9298d2d4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1665,7 +1665,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - buflen = FILE_STARTSAMPLES * sizeof(*abuf) * fh->cur_channels ? fh->cur_channels : fh->channels; + buflen = (FILE_STARTSAMPLES * sizeof(*abuf) * fh->cur_channels) > 0 ? fh->cur_channels : fh->channels; if (buflen > write_frame.buflen) { abuf = realloc(abuf, buflen); From cdfe49ee0d64a78dc599594341b8e029aae8e0f8 Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Thu, 29 Jun 2017 21:28:11 -0600 Subject: [PATCH 3/4] FS-9785: update mod_event_multicast to work with OpenSSL 1.1.0. --- .../mod_event_multicast/mod_event_multicast.c | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 011166b270..f591855a3e 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -291,7 +291,11 @@ static void event_handler(switch_event_t *event) char *buf; #ifdef HAVE_OPENSSL int outlen, tmplen; +#if OPENSSL_VERSION_NUMBER >= 0x10100000 + EVP_CIPHER_CTX *ctx; +#else EVP_CIPHER_CTX ctx; +#endif char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; switch_uuid_t uuid; @@ -309,6 +313,19 @@ static void event_handler(switch_event_t *event) if (globals.psk) { switch_copy_string(buf, uuid_str, SWITCH_UUID_FORMATTED_LENGTH); +#if OPENSSL_VERSION_NUMBER >= 0x10100000 + ctx = EVP_CIPHER_CTX_new(); + EVP_EncryptInit(ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); + EVP_EncryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); + EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH, + &outlen, (unsigned char *) packet, (int) strlen(packet)); + EVP_EncryptUpdate(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, + &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC)); + outlen += tmplen; + EVP_EncryptFinal(ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); + EVP_CIPHER_CTX_cleanup(ctx); +#else EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); @@ -320,6 +337,7 @@ static void event_handler(switch_event_t *event) outlen += tmplen; EVP_EncryptFinal(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen); EVP_CIPHER_CTX_cleanup(&ctx); +#endif outlen += tmplen; len = (size_t) outlen + SWITCH_UUID_FORMATTED_LENGTH; *(buf + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0'; @@ -530,7 +548,11 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; char *tmp; int outl, tmplen; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + EVP_CIPHER_CTX *ctx; +#else EVP_CIPHER_CTX ctx; +#endif len -= SWITCH_UUID_FORMATTED_LENGTH; @@ -541,6 +563,15 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) switch_copy_string(uuid_str, packet, SWITCH_UUID_FORMATTED_LENGTH); packet += SWITCH_UUID_FORMATTED_LENGTH; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + ctx = EVP_CIPHER_CTX_new(); + EVP_DecryptInit(ctx, EVP_bf_cbc(), NULL, NULL); + EVP_CIPHER_CTX_set_key_length(ctx, strlen(globals.psk)); + EVP_DecryptInit(ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str); + EVP_DecryptUpdate(ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len); + EVP_DecryptFinal(ctx, (unsigned char *) tmp + outl, &tmplen); + EVP_CIPHER_CTX_cleanup(ctx); +#else EVP_CIPHER_CTX_init(&ctx); EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL); EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk)); @@ -548,6 +579,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime) EVP_DecryptUpdate(&ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len); EVP_DecryptFinal(&ctx, (unsigned char *) tmp + outl, &tmplen); EVP_CIPHER_CTX_cleanup(&ctx); +#endif + *(tmp + outl + tmplen) = '\0'; /*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp)); */ From fb46f87b076608968c49bc93af539454ab78d367 Mon Sep 17 00:00:00 2001 From: "Trever L. Adams" Date: Thu, 29 Jun 2017 21:30:29 -0600 Subject: [PATCH 4/4] =?UTF-8?q?FS-9785:=20fix=20./mod=5Fconference.h:353:2?= =?UTF-8?q?3:=20error:=20enumerator=20value=20for=20=E2=80=98EFLAG=5FBLIND?= =?UTF-8?q?=5FMEMBER=E2=80=99=20is=20not=20an=20integer=20constant=20expre?= =?UTF-8?q?ssion=20[-Werror=3Dpedantic]=20EFLAG=5FBLIND=5FMEMBER=20=3D=20(?= =?UTF-8?q?1=20<<=2031)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mod/applications/mod_conference/mod_conference.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index 8bbfae2b12..512ba843b7 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -350,7 +350,7 @@ typedef enum { EFLAG_HUP_MEMBER = (1 << 28), EFLAG_PLAY_FILE_DONE = (1 << 29), EFLAG_SET_POSITION_MEMBER = (1 << 30), - EFLAG_BLIND_MEMBER = (1 << 31) + EFLAG_BLIND_MEMBER = (int)(1U << 31U) } event_type_t; #ifdef OPENAL_POSITIONING