<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6116">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Joshua Colp: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix compiler warnings on Fedora 26 / GCC 7.<br><br>GCC 7 has added capability to produce warnings, this fixes most of those<br>warnings. The specific warnings are disabled in a few places:<br><br>* app_voicemail.c: truncation of paths more than 4096 chars in many places.<br>* chan_mgcp.c: callid truncated to 80 chars.<br>* cdr.c: two userfields are combined to cdr copy, fix would break ABI.<br>* tcptls.c: ignore use of deprecated method SSLv3_client_method().<br><br>ASTERISK-27156 #close<br><br>Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88<br>---<br>M addons/chan_ooh323.c<br>M apps/Makefile<br>M apps/app_chanspy.c<br>M apps/app_followme.c<br>M apps/app_minivm.c<br>M apps/app_queue.c<br>M apps/app_voicemail.c<br>M channels/Makefile<br>M channels/chan_iax2.c<br>M channels/chan_motif.c<br>M channels/chan_sip.c<br>M channels/chan_unistim.c<br>M channels/iax2/firmware.c<br>M main/Makefile<br>M main/ast_expr2.c<br>M main/ast_expr2.y<br>M main/asterisk.c<br>M main/ccss.c<br>M main/cli.c<br>M main/libasteriskssl.c<br>M main/manager.c<br>M main/stdtime/localtime.c<br>M main/utils.c<br>M res/res_calendar.c<br>M res/res_config_pgsql.c<br>M res/res_monitor.c<br>M utils/astman.c<br>M utils/extconf.c<br>28 files changed, 94 insertions(+), 82 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c<br>index 2a89565..0d5a588 100644<br>--- a/addons/chan_ooh323.c<br>+++ b/addons/chan_ooh323.c<br>@@ -3181,7 +3181,7 @@<br> <br> static char *handle_cli_ooh323_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)<br> {<br>- char ip_port[30];<br>+ char ip_port[64];<br> struct ooh323_peer *prev = NULL, *peer = NULL;<br> <br> switch (cmd) {<br>@@ -3212,7 +3212,7 @@<br> }<br> <br> if (peer) {<br>- sprintf(ip_port, "%s:%d", peer->ip, peer->port);<br>+ sprintf(ip_port, "%s:%hu", peer->ip, peer->port);<br> ast_cli(a->fd, "%-15.15s%s\n", "Name: ", peer->name);<br> ast_cli(a->fd, "%s:%s,%s\n", "FastStart/H.245 Tunneling", peer->faststart?"yes":"no",<br> peer->h245tunneling?"yes":"no");<br>@@ -3280,7 +3280,7 @@<br> {<br> struct ooh323_peer *prev = NULL, *peer = NULL;<br> struct ast_str *codec_buf = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);<br>- char ip_port[30];<br>+ char ip_port[64];<br> #define FORMAT "%-15.15s %-15.15s %-23.23s %-s\n"<br> <br> switch (cmd) {<br>@@ -3303,7 +3303,7 @@<br> peer = peerl.peers;<br> while (peer) {<br> ast_mutex_lock(&peer->lock);<br>- snprintf(ip_port, sizeof(ip_port), "%s:%d", peer->ip, peer->port);<br>+ snprintf(ip_port, sizeof(ip_port), "%s:%hu", peer->ip, peer->port);<br> ast_cli(a->fd, FORMAT, peer->name, <br> peer->accountcode,<br> ip_port,<br>diff --git a/apps/Makefile b/apps/Makefile<br>index 7730460..d688173 100644<br>--- a/apps/Makefile<br>+++ b/apps/Makefile<br>@@ -29,6 +29,8 @@<br> <br> $(call MOD_ADD_C,app_confbridge,$(wildcard confbridge/*.c))<br> <br>+app_voicemail.o: _ASTCFLAGS+=-Wno-format-truncation<br>+<br> ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)<br> LIBS+= -lres_ael_share.so -lres_monitor.so -lres_speech.so<br> LIBS+= -lres_smdi.so<br>diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c<br>index 354b9ea..95ebace 100644<br>--- a/apps/app_chanspy.c<br>+++ b/apps/app_chanspy.c<br>@@ -1442,7 +1442,7 @@<br> static int dahdiscan_exec(struct ast_channel *chan, const char *data)<br> {<br> const char *spec = "DAHDI";<br>- struct ast_flags flags;<br>+ struct ast_flags flags = {0};<br> struct spy_dtmf_options user_options = {<br> .cycle = '#',<br> .volume = '\0',<br>diff --git a/apps/app_followme.c b/apps/app_followme.c<br>index 72afa3d..578118a 100644<br>--- a/apps/app_followme.c<br>+++ b/apps/app_followme.c<br>@@ -1558,7 +1558,7 @@<br> }<br> if (!ast_strlen_zero(targs->namerecloc)) {<br> int ret;<br>- char fn[PATH_MAX];<br>+ char fn[PATH_MAX + sizeof(REC_FORMAT)];<br> <br> snprintf(fn, sizeof(fn), "%s.%s", targs->namerecloc,<br> REC_FORMAT);<br>diff --git a/apps/app_minivm.c b/apps/app_minivm.c<br>index ff9ab34..9359f82 100644<br>--- a/apps/app_minivm.c<br>+++ b/apps/app_minivm.c<br>@@ -2251,7 +2251,7 @@<br> char ecodes[16] = "#";<br> char *tmpptr;<br> struct minivm_account *vmu;<br>- char *username = argv[0];<br>+ char *username;<br> <br> if (ast_strlen_zero(data)) {<br> ast_log(LOG_ERROR, "Minivm needs at least an account argument \n");<br>diff --git a/apps/app_queue.c b/apps/app_queue.c<br>index f297dad..004d93a 100644<br>--- a/apps/app_queue.c<br>+++ b/apps/app_queue.c<br>@@ -6610,7 +6610,6 @@<br> char oldexten[AST_MAX_EXTENSION]="";<br> char oldcontext[AST_MAX_CONTEXT]="";<br> char queuename[256]="";<br>- char interfacevar[256]="";<br> struct ast_channel *peer;<br> struct ast_channel *which;<br> struct callattempt *lpeer;<br>@@ -6811,6 +6810,7 @@<br> }<br> } else { /* peer is valid */<br> RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);<br>+ RAII_VAR(struct ast_str *, interfacevar, ast_str_create(325), ast_free);<br> /* Ah ha! Someone answered within the desired timeframe. Of course after this<br> we will always return with -1 so that it is hung up properly after the<br> conversation. */<br>@@ -6924,20 +6924,20 @@<br> ao2_lock(qe->parent);<br> /* if setinterfacevar is defined, make member variables available to the channel */<br> /* use pbx_builtin_setvar to set a load of variables with one call */<br>- if (qe->parent->setinterfacevar) {<br>- snprintf(interfacevar, sizeof(interfacevar), "MEMBERINTERFACE=%s,MEMBERNAME=%s,MEMBERCALLS=%d,MEMBERLASTCALL=%ld,MEMBERPENALTY=%d,MEMBERDYNAMIC=%d,MEMBERREALTIME=%d",<br>+ if (qe->parent->setinterfacevar && interfacevar) {<br>+ ast_str_set(&interfacevar, 0, "MEMBERINTERFACE=%s,MEMBERNAME=%s,MEMBERCALLS=%d,MEMBERLASTCALL=%ld,MEMBERPENALTY=%d,MEMBERDYNAMIC=%d,MEMBERREALTIME=%d",<br> member->interface, member->membername, member->calls, (long)member->lastcall, member->penalty, member->dynamic, member->realtime);<br>- pbx_builtin_setvar_multiple(qe->chan, interfacevar);<br>- pbx_builtin_setvar_multiple(peer, interfacevar);<br>+ pbx_builtin_setvar_multiple(qe->chan, ast_str_buffer(interfacevar));<br>+ pbx_builtin_setvar_multiple(peer, ast_str_buffer(interfacevar));<br> }<br> <br> /* if setqueueentryvar is defined, make queue entry (i.e. the caller) variables available to the channel */<br> /* use pbx_builtin_setvar to set a load of variables with one call */<br>- if (qe->parent->setqueueentryvar) {<br>- snprintf(interfacevar, sizeof(interfacevar), "QEHOLDTIME=%ld,QEORIGINALPOS=%d",<br>+ if (qe->parent->setqueueentryvar && interfacevar) {<br>+ ast_str_set(&interfacevar, 0, "QEHOLDTIME=%ld,QEORIGINALPOS=%d",<br> (long) (time(NULL) - qe->start), qe->opos);<br>- pbx_builtin_setvar_multiple(qe->chan, interfacevar);<br>- pbx_builtin_setvar_multiple(peer, interfacevar);<br>+ pbx_builtin_setvar_multiple(qe->chan, ast_str_buffer(interfacevar));<br>+ pbx_builtin_setvar_multiple(peer, ast_str_buffer(interfacevar));<br> }<br> <br> ao2_unlock(qe->parent);<br>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index 0a07cc1..5f82128 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -7913,7 +7913,7 @@<br> <br> *duration += prepend_duration;<br> msg_cat = ast_category_get(msg_cfg, "message", NULL);<br>- snprintf(duration_buf, 11, "%ld", *duration);<br>+ snprintf(duration_buf, sizeof(duration_buf), "%ld", *duration);<br> if (!ast_variable_update(msg_cat, "duration", duration_buf, NULL, 0)) {<br> ast_config_text_file_save(textfile, msg_cfg, "app_voicemail");<br> }<br>@@ -8685,7 +8685,7 @@<br> static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms)<br> {<br> int res = 0;<br>- char filename[256], *cid;<br>+ char filename[PATH_MAX], *cid;<br> const char *origtime, *context, *category, *duration, *flag;<br> struct ast_config *msg_cfg;<br> struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };<br>diff --git a/channels/Makefile b/channels/Makefile<br>index 44a0429..ae7107f 100644<br>--- a/channels/Makefile<br>+++ b/channels/Makefile<br>@@ -29,6 +29,8 @@<br> $(call MOD_ADD_C,chan_dahdi,$(wildcard dahdi/*.c) sig_analog.c sig_pri.c sig_ss7.c)<br> $(call MOD_ADD_C,chan_misdn,misdn_config.c misdn/isdn_lib.c misdn/isdn_msg_parser.c)<br> <br>+chan_mgcp.o: _ASTCFLAGS+=-Wno-format-truncation<br>+<br> chan_misdn.o: _ASTCFLAGS+=-Imisdn<br> misdn_config.o: _ASTCFLAGS+=-Imisdn<br> misdn/isdn_lib.o: _ASTCFLAGS+=-Wno-strict-aliasing<br>diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c<br>index 5abb6c3..490c4ce 100644<br>--- a/channels/chan_iax2.c<br>+++ b/channels/chan_iax2.c<br>@@ -8545,7 +8545,7 @@<br> {<br> int newcall = 0;<br> struct iax_ie_data ied;<br>- struct ast_sockaddr new;<br>+ struct ast_sockaddr new = { {0,} };<br> <br> memset(&ied, 0, sizeof(ied));<br> if (!ast_sockaddr_isnull(&ies->apparent_addr)) {<br>diff --git a/channels/chan_motif.c b/channels/chan_motif.c<br>index 7d696e8..210cf36 100644<br>--- a/channels/chan_motif.c<br>+++ b/channels/chan_motif.c<br>@@ -1901,7 +1901,7 @@<br> {<br> RAII_VAR(struct jingle_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);<br> RAII_VAR(struct jingle_endpoint *, endpoint, NULL, ao2_cleanup);<br>- char *dialed, target[200] = "";<br>+ char *dialed, target[1024] = "";<br> struct ast_xmpp_buddy *buddy;<br> struct jingle_session *session;<br> struct ast_channel *chan;<br>diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index f2daf2b..beaa3de 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -2085,7 +2085,7 @@<br> static int construct_pidf_body(enum sip_cc_publish_state state, char *pidf_body, size_t size, const char *presentity)<br> {<br> struct ast_str *body = ast_str_alloca(size);<br>- char tuple_id[32];<br>+ char tuple_id[64];<br> <br> generate_random_string(tuple_id, sizeof(tuple_id));<br> <br>@@ -15333,7 +15333,7 @@<br> {<br> struct sip_request req;<br> struct sip_cc_agent_pvt *agent_pvt = agent->private_data;<br>- char uri[SIPBUFSIZE];<br>+ char uri[SIPBUFSIZE + sizeof("cc-URI: \r\n") - 1];<br> char state_str[64];<br> char subscription_state_hdr[64];<br> <br>@@ -15350,7 +15350,7 @@<br> add_header(&req, "Subscription-State", subscription_state_hdr);<br> if (state == CC_READY) {<br> generate_uri(subscription, agent_pvt->notify_uri, sizeof(agent_pvt->notify_uri));<br>- snprintf(uri, sizeof(uri) - 1, "cc-URI: %s\r\n", agent_pvt->notify_uri);<br>+ snprintf(uri, sizeof(uri), "cc-URI: %s\r\n", agent_pvt->notify_uri);<br> }<br> add_content(&req, state_str);<br> if (state == CC_READY) {<br>diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c<br>index b820cf5..f124c0f 100644<br>--- a/channels/chan_unistim.c<br>+++ b/channels/chan_unistim.c<br>@@ -370,7 +370,7 @@<br> struct unistim_line {<br> ast_mutex_t lock;<br> char name[80]; /*! Like 200 */<br>- char fullname[80]; /*! Like USTM/200\@black */<br>+ char fullname[101]; /*! Like USTM/200\@black */<br> char exten[AST_MAX_EXTENSION]; /*! Extension where to start */<br> char cid_num[AST_MAX_EXTENSION]; /*! CallerID Number */<br> char mailbox[AST_MAX_EXTENSION]; /*! Mailbox for MWI */<br>@@ -3698,7 +3698,7 @@<br> #define SELECTCODEC_MSG "Codec number : .."<br> static void handle_select_codec(struct unistimsession *pte)<br> {<br>- char buf[30], buf2[5];<br>+ char buf[30], buf2[6];<br> <br> pte->state = STATE_SELECTCODEC;<br> ast_copy_string(buf, ustmtext("Using codec", pte), sizeof(buf));<br>diff --git a/channels/iax2/firmware.c b/channels/iax2/firmware.c<br>index 00a9d9e..500cf89 100644<br>--- a/channels/iax2/firmware.c<br>+++ b/channels/iax2/firmware.c<br>@@ -44,6 +44,8 @@<br> <br> #include "include/firmware.h"<br> <br>+#define IAX_FIRMWARE_SUBDIR "/firmware/iax"<br>+<br> struct iax_firmware {<br> AST_LIST_ENTRY(iax_firmware) list;<br> int fd;<br>@@ -206,7 +208,7 @@<br> struct iax_firmware *cur = NULL;<br> DIR *fwd;<br> struct dirent *de;<br>- char dir[256], fn[256];<br>+ char fn[PATH_MAX + sizeof(IAX_FIRMWARE_SUBDIR) + sizeof(de->d_name)];<br> <br> AST_LIST_LOCK(&firmwares);<br> <br>@@ -216,12 +218,13 @@<br> }<br> <br> /* Now that we have marked them dead... load new ones */<br>- snprintf(dir, sizeof(dir), "%s/firmware/iax", ast_config_AST_DATA_DIR);<br>- fwd = opendir(dir);<br>+ snprintf(fn, sizeof(fn), "%s%s", ast_config_AST_DATA_DIR, IAX_FIRMWARE_SUBDIR);<br>+ fwd = opendir(fn);<br> if (fwd) {<br> while((de = readdir(fwd))) {<br> if (de->d_name[0] != '.') {<br>- snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);<br>+ snprintf(fn, sizeof(fn), "%s%s/%s",<br>+ ast_config_AST_DATA_DIR, IAX_FIRMWARE_SUBDIR, de->d_name);<br> if (!try_firmware(fn)) {<br> ast_verb(2, "Loaded firmware '%s'\n", de->d_name);<br> }<br>@@ -229,7 +232,7 @@<br> }<br> closedir(fwd);<br> } else {<br>- ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));<br>+ ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", fn, strerror(errno));<br> }<br> <br> /* Clean up leftovers */<br>diff --git a/main/Makefile b/main/Makefile<br>index 4fb6a01..d816443 100644<br>--- a/main/Makefile<br>+++ b/main/Makefile<br>@@ -140,6 +140,7 @@<br> $(CMD_PREFIX) rm $@.fix<br> <br> ast_expr2f.o: _ASTCFLAGS+=-Wno-unused<br>+cdr.o: _ASTCFLAGS+=-Wno-format-truncation<br> <br> testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h<br> $(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c<br>@@ -314,7 +315,7 @@<br> <br> endif<br> <br>-tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE)<br>+tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations<br> <br> $(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(ASTPJ_LIB) $(LIBEDIT_OBJ)<br> @$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS)<br>diff --git a/main/ast_expr2.c b/main/ast_expr2.c<br>index 4b06ffe..093b441 100644<br>--- a/main/ast_expr2.c<br>+++ b/main/ast_expr2.c<br>@@ -2635,13 +2635,11 @@<br> if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)<br> return;<br> <br>- tmp = malloc ((size_t)25);<br>- if (tmp == NULL) {<br>- ast_log(LOG_WARNING,"malloc() failed\n");<br>+ if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {<br>+ ast_log(LOG_WARNING, "asprintf() failed\n");<br> return;<br> }<br> <br>- sprintf(tmp, FP___PRINTF, vp->u.i);<br> vp->type = AST_EXPR_string;<br> vp->u.s = tmp;<br> }<br>diff --git a/main/ast_expr2.y b/main/ast_expr2.y<br>index f516291..3c89430 100644<br>--- a/main/ast_expr2.y<br>+++ b/main/ast_expr2.y<br>@@ -628,13 +628,11 @@<br> if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)<br> return;<br> <br>- tmp = malloc ((size_t)25);<br>- if (tmp == NULL) {<br>- ast_log(LOG_WARNING,"malloc() failed\n");<br>+ if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {<br>+ ast_log(LOG_WARNING, "asprintf() failed\n");<br> return;<br> }<br> <br>- sprintf(tmp, FP___PRINTF, vp->u.i);<br> vp->type = AST_EXPR_string;<br> vp->u.s = tmp;<br> }<br>diff --git a/main/asterisk.c b/main/asterisk.c<br>index a302836..0a131fd 100644<br>--- a/main/asterisk.c<br>+++ b/main/asterisk.c<br>@@ -393,6 +393,9 @@<br> <br> static void asterisk_daemon(int isroot, const char *runuser, const char *rungroup);<br> <br>+#define DEFAULT_MONITOR_DIR DEFAULT_SPOOL_DIR "/monitor"<br>+#define DEFAULT_RECORDING_DIR DEFAULT_SPOOL_DIR "/recording"<br>+<br> struct _cfg_paths {<br> char config_dir[PATH_MAX];<br> char module_dir[PATH_MAX];<br>@@ -3526,8 +3529,8 @@<br> ast_copy_string(cfg_paths.config_dir, DEFAULT_CONFIG_DIR, sizeof(cfg_paths.config_dir));<br> ast_copy_string(cfg_paths.spool_dir, DEFAULT_SPOOL_DIR, sizeof(cfg_paths.spool_dir));<br> ast_copy_string(cfg_paths.module_dir, DEFAULT_MODULE_DIR, sizeof(cfg_paths.module_dir));<br>- snprintf(cfg_paths.monitor_dir, sizeof(cfg_paths.monitor_dir), "%s/monitor", cfg_paths.spool_dir);<br>- snprintf(cfg_paths.recording_dir, sizeof(cfg_paths.recording_dir), "%s/recording", cfg_paths.spool_dir);<br>+ ast_copy_string(cfg_paths.monitor_dir, DEFAULT_MONITOR_DIR, sizeof(cfg_paths.monitor_dir));<br>+ ast_copy_string(cfg_paths.recording_dir, DEFAULT_RECORDING_DIR, sizeof(cfg_paths.recording_dir));<br> ast_copy_string(cfg_paths.var_dir, DEFAULT_VAR_DIR, sizeof(cfg_paths.var_dir));<br> ast_copy_string(cfg_paths.data_dir, DEFAULT_DATA_DIR, sizeof(cfg_paths.data_dir));<br> ast_copy_string(cfg_paths.log_dir, DEFAULT_LOG_DIR, sizeof(cfg_paths.log_dir));<br>diff --git a/main/ccss.c b/main/ccss.c<br>index f96d7aa..a9d15b0 100644<br>--- a/main/ccss.c<br>+++ b/main/ccss.c<br>@@ -3546,7 +3546,7 @@<br> */<br> static void cc_unique_append(struct ast_str **str, const char *dialstring)<br> {<br>- char dialstring_search[AST_CHANNEL_NAME];<br>+ char dialstring_search[AST_CHANNEL_NAME + 1];<br> <br> if (ast_strlen_zero(dialstring)) {<br> /* No dialstring to append. */<br>diff --git a/main/cli.c b/main/cli.c<br>index 06f2d55..ef86e25 100644<br>--- a/main/cli.c<br>+++ b/main/cli.c<br>@@ -372,7 +372,7 @@<br> int i, count = 0;<br> unsigned int prospective[2];<br> unsigned int part = strtoul(partial, NULL, 10);<br>- char next[12];<br>+ char next[13];<br> <br> if (part < min || part > max) {<br> return NULL;<br>@@ -1031,7 +1031,7 @@<br> it_chans = ao2_iterator_init(channels, 0);<br> for (; (msg = ao2_iterator_next(&it_chans)); ao2_ref(msg, -1)) {<br> struct ast_channel_snapshot *cs = stasis_message_data(msg);<br>- char durbuf[10] = "-";<br>+ char durbuf[16] = "-";<br> <br> if (!count) {<br> if ((concise || verbose) && !ast_tvzero(cs->creationtime)) {<br>diff --git a/main/libasteriskssl.c b/main/libasteriskssl.c<br>index 9da63de..8b19e24 100644<br>--- a/main/libasteriskssl.c<br>+++ b/main/libasteriskssl.c<br>@@ -29,19 +29,20 @@<br> <br> #include "asterisk.h"<br> <br>+#include "asterisk/_private.h" /* ast_ssl_init() */<br>+<br> #ifdef HAVE_OPENSSL<br> #include <openssl/ssl.h><br> #include <openssl/err.h><br> #endif<br> <br>-#include <dlfcn.h><br>+#if defined(HAVE_OPENSSL) && \<br>+ !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)<br> <br>-#include "asterisk/_private.h" /* ast_ssl_init() */<br>+#include <dlfcn.h><br> <br> #include "asterisk/utils.h"<br> #include "asterisk/lock.h"<br>-<br>-#ifdef HAVE_OPENSSL<br> <br> #define get_OpenSSL_function(func) do { real_##func = dlsym(RTLD_NEXT, __stringify(func)); } while(0)<br> <br>@@ -72,7 +73,6 @@<br> }<br> }<br> <br>-#if !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)<br> int SSL_library_init(void)<br> {<br> #if defined(AST_DEVMODE)<br>@@ -114,9 +114,6 @@<br> {<br> /* we can't allow this to be called, ever */<br> }<br>-#endif /* !defined(OPENSSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000L */<br>-<br>-#endif /* HAVE_OPENSSL */<br> <br> /*!<br> * \internal<br>@@ -126,8 +123,6 @@<br> */<br> int ast_ssl_init(void)<br> {<br>-#if defined(HAVE_OPENSSL) && defined(OPENSSL_VERSION_NUMBER) && \<br>- (OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER))<br> unsigned int i;<br> int (*real_SSL_library_init)(void);<br> void (*real_CRYPTO_set_id_callback)(unsigned long (*)(void));<br>@@ -192,7 +187,14 @@<br> <br> startup_complete = 1;<br> <br>-#endif /* HAVE_OPENSSL and its version < 1.1 */<br> return 0;<br> }<br> <br>+#else<br>+<br>+int ast_ssl_init(void)<br>+{<br>+ return 0;<br>+}<br>+<br>+#endif<br>diff --git a/main/manager.c b/main/manager.c<br>index 1bbd1bb..d16a692 100644<br>--- a/main/manager.c<br>+++ b/main/manager.c<br>@@ -6115,7 +6115,7 @@<br> for (; (msg = ao2_iterator_next(&it_chans)); ao2_ref(msg, -1)) {<br> struct ast_channel_snapshot *cs = stasis_message_data(msg);<br> struct ast_str *built = ast_manager_build_channel_state_string_prefix(cs, "");<br>- char durbuf[10] = "";<br>+ char durbuf[16] = "";<br> <br> if (!built) {<br> continue;<br>diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c<br>index bb221ae..88b8020 100644<br>--- a/main/stdtime/localtime.c<br>+++ b/main/stdtime/localtime.c<br>@@ -2434,7 +2434,7 @@<br> cur = NULL;<br> AST_LIST_LOCK(&localelist);<br> for (x = 0; x < 10000; x++) {<br>- char name[5];<br>+ char name[6];<br> snprintf(name, sizeof(name), "%04d", x);<br> if (!find_by_name(name)) {<br> if ((cur = ast_calloc(1, sizeof(*cur) + strlen(name) + 1))) {<br>diff --git a/main/utils.c b/main/utils.c<br>index c254db5..f20ccd3 100644<br>--- a/main/utils.c<br>+++ b/main/utils.c<br>@@ -1490,7 +1490,7 @@<br> int found = 0;<br> char stack[8];<br> <br>- if (iss == NULL || *iss == '\0') {<br>+ if (ast_strlen_zero(st)) {<br> return NULL;<br> }<br> <br>diff --git a/res/res_calendar.c b/res/res_calendar.c<br>index 666b0e1..9ce8159 100644<br>--- a/res/res_calendar.c<br>+++ b/res/res_calendar.c<br>@@ -741,7 +741,7 @@<br> struct ast_channel *chan = NULL;<br> struct ast_variable *itervar;<br> char *tech, *dest;<br>- char buf[8];<br>+ char buf[33];<br> struct ast_format_cap *caps;<br> <br> tech = ast_strdupa(event->owner->notify_channel);<br>diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c<br>index 536c9e1..7a2c9db 100644<br>--- a/res/res_config_pgsql.c<br>+++ b/res/res_config_pgsql.c<br>@@ -1294,7 +1294,7 @@<br> /* Size is minimum length; make it at least 50% greater,<br> * just to be sure, because PostgreSQL doesn't support<br> * resizing columns. */<br>- snprintf(fieldtype, sizeof(fieldtype), "CHAR(%d)",<br>+ snprintf(fieldtype, sizeof(fieldtype), "CHAR(%hhu)",<br> size < 15 ? size * 2 :<br> (size * 3 / 2 > 255) ? 255 : size * 3 / 2);<br> } else if (type == RQ_INTEGER1 || type == RQ_UINTEGER1 || type == RQ_INTEGER2) {<br>diff --git a/res/res_monitor.c b/res/res_monitor.c<br>index 2ab52d8..fd3ff7a 100644<br>--- a/res/res_monitor.c<br>+++ b/res/res_monitor.c<br>@@ -457,7 +457,7 @@<br> LOCK_IF_NEEDED(chan, need_lock);<br> <br> if (ast_channel_monitor(chan)) {<br>- char filename[ FILENAME_MAX ];<br>+ RAII_VAR(struct ast_str *, tmp, ast_str_create(1024), ast_free);<br> <br> if (ast_channel_monitor(chan)->read_stream) {<br> ast_closestream(ast_channel_monitor(chan)->read_stream);<br>@@ -466,31 +466,29 @@<br> ast_closestream(ast_channel_monitor(chan)->write_stream);<br> }<br> <br>- if (ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br>+ if (tmp && ast_channel_monitor(chan)->filename_changed && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br> if (ast_fileexists(ast_channel_monitor(chan)->read_filename,NULL,NULL) > 0) {<br>- snprintf(filename, FILENAME_MAX, "%s-in", ast_channel_monitor(chan)->filename_base);<br>- if (ast_fileexists(filename, NULL, NULL) > 0) {<br>- ast_filedelete(filename, NULL);<br>+ ast_str_set(&tmp, 0, "%s-in", ast_channel_monitor(chan)->filename_base);<br>+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {<br>+ ast_filedelete(ast_str_buffer(tmp), NULL);<br> }<br>- ast_filerename(ast_channel_monitor(chan)->read_filename, filename, ast_channel_monitor(chan)->format);<br>+ ast_filerename(ast_channel_monitor(chan)->read_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);<br> } else {<br> ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->read_filename);<br> }<br> <br>- if (ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {<br>- snprintf(filename, FILENAME_MAX, "%s-out", ast_channel_monitor(chan)->filename_base);<br>- if (ast_fileexists(filename, NULL, NULL) > 0) {<br>- ast_filedelete(filename, NULL);<br>+ if (tmp && ast_fileexists(ast_channel_monitor(chan)->write_filename,NULL,NULL) > 0) {<br>+ ast_str_set(&tmp, 0, "%s-out", ast_channel_monitor(chan)->filename_base);<br>+ if (ast_fileexists(ast_str_buffer(tmp), NULL, NULL) > 0) {<br>+ ast_filedelete(ast_str_buffer(tmp), NULL);<br> }<br>- ast_filerename(ast_channel_monitor(chan)->write_filename, filename, ast_channel_monitor(chan)->format);<br>+ ast_filerename(ast_channel_monitor(chan)->write_filename, ast_str_buffer(tmp), ast_channel_monitor(chan)->format);<br> } else {<br> ast_log(LOG_WARNING, "File %s not found\n", ast_channel_monitor(chan)->write_filename);<br> }<br> }<br> <br>- if (ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br>- char tmp[1024];<br>- char tmp2[1024];<br>+ if (tmp && ast_channel_monitor(chan)->joinfiles && !ast_strlen_zero(ast_channel_monitor(chan)->filename_base)) {<br> const char *format = !strcasecmp(ast_channel_monitor(chan)->format,"wav49") ? "WAV" : ast_channel_monitor(chan)->format;<br> char *fname_base = ast_channel_monitor(chan)->filename_base;<br> const char *execute, *execute_args;<br>@@ -511,16 +509,17 @@<br> if (ast_strlen_zero(execute_args)) {<br> execute_args = "";<br> }<br>- <br>- snprintf(tmp, sizeof(tmp), "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",<br>+<br>+ ast_str_set(&tmp, 0, delfiles ? "( " : "");<br>+ ast_str_append(&tmp, 0, "%s \"%s-in.%s\" \"%s-out.%s\" \"%s.%s\" %s &",<br> execute, fname_base, format, fname_base, format, fname_base, format,execute_args);<br> if (delfiles) {<br>- snprintf(tmp2,sizeof(tmp2), "( %s& rm -f \"%s-\"* ) &",tmp, fname_base); /* remove legs when done mixing */<br>- ast_copy_string(tmp, tmp2, sizeof(tmp));<br>+ /* remove legs when done mixing */<br>+ ast_str_append(&tmp, 0, "& rm -f \"%s-\"* ) &", fname_base);<br> }<br>- ast_debug(1,"monitor executing %s\n",tmp);<br>- if (ast_safe_system(tmp) == -1)<br>- ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);<br>+ ast_debug(1,"monitor executing %s\n", ast_str_buffer(tmp));<br>+ if (ast_safe_system(ast_str_buffer(tmp)) == -1)<br>+ ast_log(LOG_WARNING, "Execute of %s failed.\n", ast_str_buffer(tmp));<br> }<br> <br> if (!ast_strlen_zero(ast_channel_monitor(chan)->beep_id)) {<br>diff --git a/utils/astman.c b/utils/astman.c<br>index 63d7f5a..af31851 100644<br>--- a/utils/astman.c<br>+++ b/utils/astman.c<br>@@ -275,7 +275,7 @@<br> {<br> void *prev = NULL;<br> struct ast_chan *chan;<br>- char tmpn[42];<br>+ char tmpn[sizeof(chan->name) + sizeof(chan->callerid) + 3 - 1];<br> char tmp[256];<br> int x=0;<br> prev = newtListboxGetCurrent(c);<br>diff --git a/utils/extconf.c b/utils/extconf.c<br>index d035e12..1163022 100644<br>--- a/utils/extconf.c<br>+++ b/utils/extconf.c<br>@@ -4605,6 +4605,10 @@<br> struct ast_exten *e, *eroot;<br> struct ast_include *i;<br> <br>+ if (!context) {<br>+ return NULL;<br>+ }<br>+<br> /* Initialize status if appropriate */<br> if (q->stacklen == 0) {<br> q->status = STATUS_NO_CONTEXT;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6116">change 6116</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6116"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88 </div>
<div style="display:none"> Gerrit-Change-Number: 6116 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>