<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9468">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix GCC 8 build issues.<br><br>This fixes build warnings found by GCC 8. In some cases format<br>truncation is intentional so the warning is just suppressed.<br><br>ASTERISK-27824 #close<br><br>Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84<br>---<br>M addons/Makefile<br>M apps/Makefile<br>M apps/app_minivm.c<br>M apps/app_queue.c<br>M apps/app_sms.c<br>M apps/app_test.c<br>M apps/app_voicemail.c<br>M channels/Makefile<br>M channels/chan_dahdi.c<br>M channels/chan_iax2.c<br>M channels/chan_sip.c<br>M channels/chan_skinny.c<br>M channels/iax2/parser.c<br>M configure<br>M configure.ac<br>M funcs/Makefile<br>M main/config.c<br>M main/manager.c<br>M main/pbx.c<br>M makeopts.in<br>M pbx/dundi-parser.c<br>M pbx/pbx_dundi.c<br>M res/Makefile<br>M res/res_config_ldap.c<br>M res/res_musiconhold.c<br>M tests/Makefile<br>M utils/Makefile<br>M utils/ael_main.c<br>M utils/astman.c<br>M utils/db1-ast/hash/ndbm.c<br>M utils/extconf.c<br>31 files changed, 128 insertions(+), 64 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/9468/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/addons/Makefile b/addons/Makefile</span><br><span>index 3d4045d..0c11bfc 100644</span><br><span>--- a/addons/Makefile</span><br><span>+++ b/addons/Makefile</span><br><span>@@ -65,6 +65,7 @@</span><br><span> format_mp3.so: mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o</span><br><span> endif</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+chan_mobile.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span> chan_ooh323.o: _ASTCFLAGS+=$(H323CFLAGS)</span><br><span> chan_ooh323.so: _ASTCFLAGS+=$(H323CFLAGS)</span><br><span> chan_ooh323.so: $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o</span><br><span>diff --git a/apps/Makefile b/apps/Makefile</span><br><span>index 13c77ab..3e3dc00 100644</span><br><span>--- a/apps/Makefile</span><br><span>+++ b/apps/Makefile</span><br><span>@@ -30,7 +30,11 @@</span><br><span> clean::</span><br><span> rm -f confbridge/*.o confbridge/*.i confbridge/*.gcda confbridge/*.gcno</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+app_confbridge.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+app_meetme.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+app_minivm.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span> app_voicemail.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+app_while.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span> </span><br><span> app_confbridge.so: $(subst .c,.o,$(wildcard confbridge/*.c))</span><br><span> $(subst .c,.o,$(wildcard confbridge/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,app_confbridge)</span><br><span>diff --git a/apps/app_minivm.c b/apps/app_minivm.c</span><br><span>index a4b9f8b..64f6ff7 100644</span><br><span>--- a/apps/app_minivm.c</span><br><span>+++ b/apps/app_minivm.c</span><br><span>@@ -2789,11 +2789,11 @@</span><br><span> switch (tmpwrite[1]) {</span><br><span> case 'n':</span><br><span> memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(tmpwrite, "\n", len);</span><br><span style="color: hsl(120, 100%, 40%);">+ tmpwrite[0] = '\n';</span><br><span> break;</span><br><span> case 't':</span><br><span> memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(tmpwrite, "\t", len);</span><br><span style="color: hsl(120, 100%, 40%);">+ tmpwrite[0] = '\t';</span><br><span> break;</span><br><span> default:</span><br><span> ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);</span><br><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index b42eac2..f783ac9 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -6411,7 +6411,7 @@</span><br><span> static void setup_mixmonitor(struct queue_ent *qe, const char *filename)</span><br><span> {</span><br><span> char escaped_filename[256];</span><br><span style="color: hsl(0, 100%, 40%);">- char file_with_ext[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ char file_with_ext[sizeof(escaped_filename) + sizeof(qe->parent->monfmt)];</span><br><span> char mixmonargs[1512];</span><br><span> char escaped_monitor_exec[1024];</span><br><span> const char *monitor_options;</span><br><span>diff --git a/apps/app_sms.c b/apps/app_sms.c</span><br><span>index 01b4f06..c2bfb1e 100644</span><br><span>--- a/apps/app_sms.c</span><br><span>+++ b/apps/app_sms.c</span><br><span>@@ -1208,7 +1208,7 @@</span><br><span> {</span><br><span> struct ast_tm tm;</span><br><span> struct timeval now = h->scts;</span><br><span style="color: hsl(0, 100%, 40%);">- char stm[9];</span><br><span style="color: hsl(120, 100%, 40%);">+ char stm[45];</span><br><span> </span><br><span> h->omsg[0] = 0x00; /* set later... */</span><br><span> h->omsg[1] = 0;</span><br><span>diff --git a/apps/app_test.c b/apps/app_test.c</span><br><span>index 6f0515a..dd624d0 100644</span><br><span>--- a/apps/app_test.c</span><br><span>+++ b/apps/app_test.c</span><br><span>@@ -333,7 +333,6 @@</span><br><span> {</span><br><span> int res = 0;</span><br><span> char testid[80]="";</span><br><span style="color: hsl(0, 100%, 40%);">- char fn[80];</span><br><span> FILE *f;</span><br><span> if (ast_channel_state(chan) != AST_STATE_UP)</span><br><span> res = ast_answer(chan);</span><br><span>@@ -360,6 +359,8 @@</span><br><span> if (strchr(testid, '/'))</span><br><span> res = -1;</span><br><span> if ((res >=0) && (!ast_strlen_zero(testid))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char fn[PATH_MAX];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Got a Test ID! Whoo hoo! */</span><br><span> /* Make the directory to hold the test results in case it's not there */</span><br><span> snprintf(fn, sizeof(fn), "%s/testresults", ast_config_AST_LOG_DIR);</span><br><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index 86f2873..db65c12 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -1010,7 +1010,7 @@</span><br><span> int old_new;</span><br><span> int old_old;</span><br><span> char *uniqueid;</span><br><span style="color: hsl(0, 100%, 40%);">- char mailbox[1];</span><br><span style="color: hsl(120, 100%, 40%);">+ char mailbox[0];</span><br><span> };</span><br><span> </span><br><span> struct mwi_sub_task {</span><br><span>@@ -13167,7 +13167,7 @@</span><br><span> struct mwi_sub *mwi_sub;</span><br><span> struct mwi_sub_task *p = datap;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- len = sizeof(*mwi_sub);</span><br><span style="color: hsl(120, 100%, 40%);">+ len = sizeof(*mwi_sub) + 1;</span><br><span> if (!ast_strlen_zero(p->mailbox))</span><br><span> len += strlen(p->mailbox);</span><br><span> </span><br><span>diff --git a/channels/Makefile b/channels/Makefile</span><br><span>index 6314279..49adb34 100644</span><br><span>--- a/channels/Makefile</span><br><span>+++ b/channels/Makefile</span><br><span>@@ -50,6 +50,9 @@</span><br><span> $(CHAN_DAHDI_OBJS): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_dahdi)</span><br><span> </span><br><span> chan_mgcp.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+chan_unistim.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+chan_phone.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+chan_sip.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span> </span><br><span> chan_misdn.o: _ASTCFLAGS+=-Imisdn</span><br><span> </span><br><span>diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c</span><br><span>index 8669267..6870e67 100644</span><br><span>--- a/channels/chan_dahdi.c</span><br><span>+++ b/channels/chan_dahdi.c</span><br><span>@@ -1864,7 +1864,7 @@</span><br><span> */</span><br><span> static void dahdi_ami_channel_event(struct dahdi_pvt *p, struct ast_channel *chan)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- char ch_name[20];</span><br><span style="color: hsl(120, 100%, 40%);">+ char ch_name[23];</span><br><span> </span><br><span> if (p->channel < CHAN_PSEUDO) {</span><br><span> /* No B channel */</span><br><span>diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c</span><br><span>index 97cbe73..90d2316 100644</span><br><span>--- a/channels/chan_iax2.c</span><br><span>+++ b/channels/chan_iax2.c</span><br><span>@@ -14319,7 +14319,7 @@</span><br><span> static int iax2_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)</span><br><span> {</span><br><span> char odata[256];</span><br><span style="color: hsl(0, 100%, 40%);">- char req[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ char req[sizeof(odata) + AST_MAX_CONTEXT + AST_MAX_EXTENSION + sizeof("IAX2//@")];</span><br><span> char *ncontext;</span><br><span> struct iax2_dpcache *dp = NULL;</span><br><span> struct ast_app *dial = NULL;</span><br><span>diff --git a/channels/chan_sip.c b/channels/chan_sip.c</span><br><span>index 890939f..0f64309 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -35002,21 +35002,22 @@</span><br><span> struct ast_str *overflow;</span><br><span> struct {</span><br><span> char **fragments;</span><br><span style="color: hsl(120, 100%, 40%);">+ size_t fragment_count;</span><br><span> char **expected;</span><br><span> int num_expected;</span><br><span> const char *description;</span><br><span> } tests[] = {</span><br><span style="color: hsl(0, 100%, 40%);">- { normal, normal, 1, "normal" },</span><br><span style="color: hsl(0, 100%, 40%);">- { fragmented, normal, 1, "fragmented" },</span><br><span style="color: hsl(0, 100%, 40%);">- { fragmented_body, normal, 1, "fragmented_body" },</span><br><span style="color: hsl(0, 100%, 40%);">- { multi_fragment, normal, 1, "multi_fragment" },</span><br><span style="color: hsl(0, 100%, 40%);">- { multi_message, multi_message_divided, 2, "multi_message" },</span><br><span style="color: hsl(0, 100%, 40%);">- { multi_message_body, multi_message_body_divided, 2, "multi_message_body" },</span><br><span style="color: hsl(0, 100%, 40%);">- { multi_message_in_fragments, multi_message_divided, 2, "multi_message_in_fragments" },</span><br><span style="color: hsl(0, 100%, 40%);">- { compact, compact, 1, "compact" },</span><br><span style="color: hsl(0, 100%, 40%);">- { faux, faux, 1, "faux" },</span><br><span style="color: hsl(0, 100%, 40%);">- { folded, folded, 1, "folded" },</span><br><span style="color: hsl(0, 100%, 40%);">- { cl_in_body, cl_in_body, 1, "cl_in_body" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { normal, ARRAY_LEN(normal), normal, 1, "normal" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { fragmented, ARRAY_LEN(fragmented), normal, 1, "fragmented" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { fragmented_body, ARRAY_LEN(fragmented_body), normal, 1, "fragmented_body" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { multi_fragment, ARRAY_LEN(multi_fragment), normal, 1, "multi_fragment" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { multi_message, ARRAY_LEN(multi_message), multi_message_divided, 2, "multi_message" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { multi_message_body, ARRAY_LEN(multi_message_body), multi_message_body_divided, 2, "multi_message_body" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { multi_message_in_fragments, ARRAY_LEN(multi_message_in_fragments), multi_message_divided, 2, "multi_message_in_fragments" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { compact, ARRAY_LEN(compact), compact, 1, "compact" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { faux, ARRAY_LEN(faux), faux, 1, "faux" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { folded, ARRAY_LEN(folded), folded, 1, "folded" },</span><br><span style="color: hsl(120, 100%, 40%);">+ { cl_in_body, ARRAY_LEN(cl_in_body), cl_in_body, 1, "cl_in_body" },</span><br><span> };</span><br><span> int i;</span><br><span> enum ast_test_result_state res = AST_TEST_PASS;</span><br><span>@@ -35044,7 +35045,7 @@</span><br><span> }</span><br><span> for (i = 0; i < ARRAY_LEN(tests); ++i) {</span><br><span> int num_messages = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (mock_tcp_loop(tests[i].fragments, ARRAY_LEN(tests[i].fragments),</span><br><span style="color: hsl(120, 100%, 40%);">+ if (mock_tcp_loop(tests[i].fragments, tests[i].fragment_count,</span><br><span> &overflow, tests[i].expected, &num_messages, test)) {</span><br><span> ast_test_status_update(test, "Failed to parse message '%s'\n", tests[i].description);</span><br><span> res = AST_TEST_FAIL;</span><br><span>diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c</span><br><span>index e93235f..91322bd 100644</span><br><span>--- a/channels/chan_skinny.c</span><br><span>+++ b/channels/chan_skinny.c</span><br><span>@@ -3710,49 +3710,49 @@</span><br><span> int posn = 0;</span><br><span> </span><br><span> ptr = dbgcli_buf;</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "\0", 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ ptr[0] = '\0';</span><br><span> if (skinnydebug & DEBUG_GENERAL) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "general ", 8);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "general "); /* SAFE */</span><br><span> posn += 8;</span><br><span> ptr += 8;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_SUB) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "sub ", 4);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "sub "); /* SAFE */</span><br><span> posn += 4;</span><br><span> ptr += 4;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_AUDIO) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "audio ", 6);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "audio "); /* SAFE */</span><br><span> posn += 6;</span><br><span> ptr += 6;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_PACKET) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "packet ", 7);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "packet "); /* SAFE */</span><br><span> posn += 7;</span><br><span> ptr += 7;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_LOCK) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "lock ", 5);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "lock "); /* SAFE */</span><br><span> posn += 5;</span><br><span> ptr += 5;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_TEMPLATE) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "template ", 9);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "template "); /* SAFE */</span><br><span> posn += 9;</span><br><span> ptr += 9;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_THREAD) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "thread ", 7);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "thread "); /* SAFE */</span><br><span> posn += 7;</span><br><span> ptr += 7;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_HINT) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "hint ", 5);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "hint "); /* SAFE */</span><br><span> posn += 5;</span><br><span> ptr += 5;</span><br><span> }</span><br><span> if (skinnydebug & DEBUG_KEEPALIVE) {</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(ptr, "keepalive ", 10);</span><br><span style="color: hsl(120, 100%, 40%);">+ strcpy(ptr, "keepalive "); /* SAFE */</span><br><span> posn += 10;</span><br><span> ptr += 10;</span><br><span> }</span><br><span>@@ -6431,7 +6431,6 @@</span><br><span> case STIMULUS_CALLPARK:</span><br><span> {</span><br><span> char extout[AST_MAX_EXTENSION];</span><br><span style="color: hsl(0, 100%, 40%);">- char message[32];</span><br><span> RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);</span><br><span> SKINNY_DEBUG(DEBUG_PACKET, 3, "Received STIMULUS_CALLPARK from %s, inst %d, callref %d\n",</span><br><span> d->name, instance, callreference);</span><br><span>@@ -6453,7 +6452,10 @@</span><br><span> }</span><br><span> </span><br><span> if (!ast_parking_park_call(bridge_channel, extout, sizeof(extout))) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(message, sizeof(message), "Call Parked at: %s", extout);</span><br><span style="color: hsl(120, 100%, 40%);">+ static const char msg_prefix[] = "Call Parked at: ";</span><br><span style="color: hsl(120, 100%, 40%);">+ char message[sizeof(msg_prefix) + sizeof(extout)];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(message, sizeof(message), "%s%s", msg_prefix, extout);</span><br><span> transmit_displaynotify(d, message, 10);</span><br><span> break;</span><br><span> }</span><br><span>@@ -7184,7 +7186,6 @@</span><br><span> case SOFTKEY_PARK:</span><br><span> {</span><br><span> char extout[AST_MAX_EXTENSION];</span><br><span style="color: hsl(0, 100%, 40%);">- char message[32];</span><br><span> RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);</span><br><span> SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_PARK from %s, inst %d, callref %d\n",</span><br><span> d->name, instance, callreference);</span><br><span>@@ -7206,7 +7207,10 @@</span><br><span> }</span><br><span> </span><br><span> if (!ast_parking_park_call(bridge_channel, extout, sizeof(extout))) {</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(message, sizeof(message), "Call Parked at: %s", extout);</span><br><span style="color: hsl(120, 100%, 40%);">+ static const char msg_prefix[] = "Call Parked at: ";</span><br><span style="color: hsl(120, 100%, 40%);">+ char message[sizeof(msg_prefix) + sizeof(extout)];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(message, sizeof(message), "%s%s", msg_prefix, extout);</span><br><span> transmit_displaynotify(d, message, 10);</span><br><span> break;</span><br><span> }</span><br><span>diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c</span><br><span>index c003a82..ec7226e 100644</span><br><span>--- a/channels/iax2/parser.c</span><br><span>+++ b/channels/iax2/parser.c</span><br><span>@@ -417,7 +417,7 @@</span><br><span> int x;</span><br><span> int found;</span><br><span> char interp[1024];</span><br><span style="color: hsl(0, 100%, 40%);">- char tmp[1024];</span><br><span style="color: hsl(120, 100%, 40%);">+ char tmp[1046];</span><br><span> </span><br><span> if (len < 2)</span><br><span> return;</span><br><span>diff --git a/configure b/configure</span><br><span>index d8aebc7..732f6ca 100755</span><br><span>--- a/configure</span><br><span>+++ b/configure</span><br><span>@@ -686,6 +686,7 @@</span><br><span> AST_RPATH</span><br><span> AST_NATIVE_ARCH</span><br><span> AST_SHADOW_WARNINGS</span><br><span style="color: hsl(120, 100%, 40%);">+AST_NO_STRINGOP_TRUNCATION</span><br><span> AST_NO_FORMAT_TRUNCATION</span><br><span> AST_NO_STRICT_OVERFLOW</span><br><span> AST_FORTIFY_SOURCE</span><br><span>@@ -18611,6 +18612,19 @@</span><br><span> fi</span><br><span> </span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wno-stringop-truncation" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo_n "checking for -Wno-stringop-truncation... " >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+if $(${CC} -Wno-stringop-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then</span><br><span style="color: hsl(120, 100%, 40%);">+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "yes" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_NO_STRINGOP_TRUNCATION=-Wno-stringop-truncation</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5</span><br><span style="color: hsl(120, 100%, 40%);">+$as_echo "no" >&6; }</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_NO_STRINGOP_TRUNCATION=</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5</span><br><span> $as_echo_n "checking for -Wshadow... " >&6; }</span><br><span> if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then</span><br><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 61db0e2..46f62b8 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -1277,6 +1277,16 @@</span><br><span> fi</span><br><span> AC_SUBST(AST_NO_FORMAT_TRUNCATION)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+AC_MSG_CHECKING(for -Wno-stringop-truncation)</span><br><span style="color: hsl(120, 100%, 40%);">+if $(${CC} -Wno-stringop-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then</span><br><span style="color: hsl(120, 100%, 40%);">+ AC_MSG_RESULT(yes)</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_NO_STRINGOP_TRUNCATION=-Wno-stringop-truncation</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+ AC_MSG_RESULT(no)</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_NO_STRINGOP_TRUNCATION=</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+AC_SUBST(AST_NO_STRINGOP_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> AC_MSG_CHECKING(for -Wshadow)</span><br><span> if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then</span><br><span> AC_MSG_RESULT(yes)</span><br><span>diff --git a/funcs/Makefile b/funcs/Makefile</span><br><span>index 3f65070..40df635 100644</span><br><span>--- a/funcs/Makefile</span><br><span>+++ b/funcs/Makefile</span><br><span>@@ -25,3 +25,5 @@</span><br><span> # warning must be disabled; for safety reasons, SPRINTF() is kept in</span><br><span> # a separate module so that as little code as possible is left unchecked</span><br><span> func_sprintf.o: _ASTCFLAGS+=-Wno-format-nonliteral</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+func_groupcount.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span>diff --git a/main/config.c b/main/config.c</span><br><span>index 1cb5bbe..da6d6f1 100644</span><br><span>--- a/main/config.c</span><br><span>+++ b/main/config.c</span><br><span>@@ -1738,7 +1738,7 @@</span><br><span> char *c;</span><br><span> char *cur = buf;</span><br><span> struct ast_variable *v;</span><br><span style="color: hsl(0, 100%, 40%);">- char cmd[512], exec_file[512];</span><br><span style="color: hsl(120, 100%, 40%);">+ char exec_file[512];</span><br><span> </span><br><span> /* Actually parse the entry */</span><br><span> if (cur[0] == '[') { /* A category header */</span><br><span>@@ -1911,10 +1911,16 @@</span><br><span> We create a tmp file, then we #include it, then we delete it. */</span><br><span> if (!do_include) {</span><br><span> struct timeval now = ast_tvnow();</span><br><span style="color: hsl(120, 100%, 40%);">+ char cmd[1024];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (!ast_test_flag(&flags, CONFIG_FLAG_NOCACHE))</span><br><span> config_cache_attribute(configfile, ATTRIBUTE_EXEC, NULL, who_asked);</span><br><span> snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d%d.%ld", (int)now.tv_sec, (int)now.tv_usec, (long)pthread_self());</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file) >= sizeof(cmd)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Failed to construct command string to execute %s.\n", cur);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> ast_safe_system(cmd);</span><br><span> cur = exec_file;</span><br><span> } else {</span><br><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index 46bc440..0181454 100644</span><br><span>--- a/main/manager.c</span><br><span>+++ b/main/manager.c</span><br><span>@@ -7989,7 +7989,8 @@</span><br><span> /* compute the expected response to compare with what we received */</span><br><span> {</span><br><span> char *a2;</span><br><span style="color: hsl(0, 100%, 40%);">- char a2_hash[256];</span><br><span style="color: hsl(120, 100%, 40%);">+ /* ast_md5_hash outputs 32 characters plus NULL terminator. */</span><br><span style="color: hsl(120, 100%, 40%);">+ char a2_hash[33];</span><br><span> char resp[256];</span><br><span> </span><br><span> /* XXX Now request method are hardcoded in A2 */</span><br><span>diff --git a/main/pbx.c b/main/pbx.c</span><br><span>index b4599de..bcfd42d 100644</span><br><span>--- a/main/pbx.c</span><br><span>+++ b/main/pbx.c</span><br><span>@@ -6165,7 +6165,7 @@</span><br><span> char *last_presence_message;</span><br><span> </span><br><span> AST_LIST_ENTRY(store_hint) list;</span><br><span style="color: hsl(0, 100%, 40%);">- char data[1];</span><br><span style="color: hsl(120, 100%, 40%);">+ char data[0];</span><br><span> };</span><br><span> </span><br><span> AST_LIST_HEAD_NOLOCK(store_hints, store_hint);</span><br><span>diff --git a/makeopts.in b/makeopts.in</span><br><span>index bedd2fa..6683d6e 100644</span><br><span>--- a/makeopts.in</span><br><span>+++ b/makeopts.in</span><br><span>@@ -119,6 +119,7 @@</span><br><span> AST_TRAMPOLINES=@AST_TRAMPOLINES@</span><br><span> AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@</span><br><span> AST_NO_FORMAT_TRUNCATION=@AST_NO_FORMAT_TRUNCATION@</span><br><span style="color: hsl(120, 100%, 40%);">+AST_NO_STRINGOP_TRUNCATION=@AST_NO_STRINGOP_TRUNCATION@</span><br><span> AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@</span><br><span> AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@</span><br><span> AST_CLANG_BLOCKS=@AST_CLANG_BLOCKS@</span><br><span>diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c</span><br><span>index 9ca0dfb..daa7d71 100644</span><br><span>--- a/pbx/dundi-parser.c</span><br><span>+++ b/pbx/dundi-parser.c</span><br><span>@@ -388,7 +388,7 @@</span><br><span> int x;</span><br><span> int found;</span><br><span> char interp[1024];</span><br><span style="color: hsl(0, 100%, 40%);">- char tmp[1024];</span><br><span style="color: hsl(120, 100%, 40%);">+ char tmp[1051];</span><br><span> if (len < 2)</span><br><span> return;</span><br><span> while(len >= 2) {</span><br><span>diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c</span><br><span>index 2513900..ff68dbc 100644</span><br><span>--- a/pbx/pbx_dundi.c</span><br><span>+++ b/pbx/pbx_dundi.c</span><br><span>@@ -1240,7 +1240,6 @@</span><br><span> </span><br><span> static int cache_lookup(struct dundi_request *req, dundi_eid *peer_eid, uint32_t crc, int *lowexpiration)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- char key[256];</span><br><span> char eid_str[20];</span><br><span> char eidroot_str[20];</span><br><span> time_t now;</span><br><span>@@ -1248,6 +1247,8 @@</span><br><span> int res2=0;</span><br><span> char eid_str_full[20];</span><br><span> char tmp[256]="";</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Enough space for largest value that can be stored in key. */</span><br><span style="color: hsl(120, 100%, 40%);">+ char key[sizeof(eid_str) + sizeof(tmp) + sizeof(req->dcontext) + sizeof(eidroot_str) + sizeof("hint////r")];</span><br><span> int x;</span><br><span> </span><br><span> time(&now);</span><br><span>diff --git a/res/Makefile b/res/Makefile</span><br><span>index 5a8f35a..4865883 100644</span><br><span>--- a/res/Makefile</span><br><span>+++ b/res/Makefile</span><br><span>@@ -29,7 +29,7 @@</span><br><span> res_config_ldap.o: _ASTCFLAGS+=-DLDAP_DEPRECATED</span><br><span> </span><br><span> ael/ael_lex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h</span><br><span style="color: hsl(0, 100%, 40%);">-ael/ael_lex.o: _ASTCFLAGS+=-I. -Iael -Wno-unused</span><br><span style="color: hsl(120, 100%, 40%);">+ael/ael_lex.o: _ASTCFLAGS+=-I. -Iael -Wno-unused $(AST_NO_FORMAT_TRUNCATION)</span><br><span> </span><br><span> ael/ael.tab.o: ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h</span><br><span> ael/ael.tab.o: _ASTCFLAGS+=-I. -Iael -DYYENABLE_NLS=0</span><br><span>@@ -95,5 +95,7 @@</span><br><span> res_stasis_recording.so: stasis_recording/stored.o</span><br><span> stasis_recording/stored.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis_recording)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+res_parking.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # Dependencies for res_ari_*.so are generated, so they're in this file</span><br><span> include ari.make</span><br><span>diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c</span><br><span>index 243dfc9..41d8f4b 100644</span><br><span>--- a/res/res_config_ldap.c</span><br><span>+++ b/res/res_config_ldap.c</span><br><span>@@ -1962,7 +1962,7 @@</span><br><span> */</span><br><span> static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- char status[256], credentials[100] = "";</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ast_str *buf;</span><br><span> int ctimesec = time(NULL) - connect_time;</span><br><span> </span><br><span> switch (cmd) {</span><br><span>@@ -1979,30 +1979,33 @@</span><br><span> if (!ldapConn)</span><br><span> return CLI_FAILURE;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(url))</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(status, sizeof(status), "Connected to '%s', baseDN %s", url, base_distinguished_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ buf = ast_str_create(512);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(url)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&buf, 0, "Connected to '%s', baseDN %s", url, base_distinguished_name);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!ast_strlen_zero(user))</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(credentials, sizeof(credentials), " with username %s", user);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!ast_strlen_zero(user)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&buf, 0, " with username %s", user);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> if (ctimesec > 31536000) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(0, 100%, 40%);">- status, credentials, ctimesec / 31536000,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "%s for %d years, %d days, %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_buffer(buf), ctimesec / 31536000,</span><br><span> (ctimesec % 31536000) / 86400, (ctimesec % 86400) / 3600,</span><br><span> (ctimesec % 3600) / 60, ctimesec % 60);</span><br><span> } else if (ctimesec > 86400) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s%s for %d days, %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(0, 100%, 40%);">- status, credentials, ctimesec / 86400, (ctimesec % 86400) / 3600,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "%s for %d days, %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_buffer(buf), ctimesec / 86400, (ctimesec % 86400) / 3600,</span><br><span> (ctimesec % 3600) / 60, ctimesec % 60);</span><br><span> } else if (ctimesec > 3600) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s%s for %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(0, 100%, 40%);">- status, credentials, ctimesec / 3600, (ctimesec % 3600) / 60,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "%s for %d hours, %d minutes, %d seconds.\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_buffer(buf), ctimesec / 3600, (ctimesec % 3600) / 60,</span><br><span> ctimesec % 60);</span><br><span> } else if (ctimesec > 60) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s%s for %d minutes, %d seconds.\n", status, credentials,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "%s for %d minutes, %d seconds.\n", ast_str_buffer(buf),</span><br><span> ctimesec / 60, ctimesec % 60);</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_cli(a->fd, "%s%s for %d seconds.\n", status, credentials, ctimesec);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_cli(a->fd, "%s for %d seconds.\n", ast_str_buffer(buf), ctimesec);</span><br><span> }</span><br><span> </span><br><span> return CLI_SUCCESS;</span><br><span>diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c</span><br><span>index 17bcd90..4d98f60 100644</span><br><span>--- a/res/res_musiconhold.c</span><br><span>+++ b/res/res_musiconhold.c</span><br><span>@@ -1105,7 +1105,7 @@</span><br><span> </span><br><span> DIR *files_DIR;</span><br><span> struct dirent *files_dirent;</span><br><span style="color: hsl(0, 100%, 40%);">- char dir_path[PATH_MAX];</span><br><span style="color: hsl(120, 100%, 40%);">+ char dir_path[PATH_MAX - sizeof(class->dir)];</span><br><span> char filepath[PATH_MAX];</span><br><span> char *ext;</span><br><span> struct stat statbuf;</span><br><span>diff --git a/tests/Makefile b/tests/Makefile</span><br><span>index a65b88b..f64669b 100644</span><br><span>--- a/tests/Makefile</span><br><span>+++ b/tests/Makefile</span><br><span>@@ -18,3 +18,6 @@</span><br><span> all: _all</span><br><span> </span><br><span> include $(ASTTOPDIR)/Makefile.moddir_rules</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+test_strings.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION) $(AST_NO_STRINGOP_TRUNCATION)</span><br><span style="color: hsl(120, 100%, 40%);">+test_voicemail_api.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)</span><br><span>diff --git a/utils/Makefile b/utils/Makefile</span><br><span>index cabc268..0a3baec 100644</span><br><span>--- a/utils/Makefile</span><br><span>+++ b/utils/Makefile</span><br><span>@@ -157,7 +157,7 @@</span><br><span> $(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"</span><br><span> $(CMD_PREFIX) mv "$@.new" "$@"</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused</span><br><span style="color: hsl(120, 100%, 40%);">+aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused $(AST_NO_FORMAT_TRUNCATION)</span><br><span> aelparse: LIBS+=-lm $(AST_CLANG_BLOCKS_LIBS)</span><br><span> aelparse: aelparse.o aelbison.o pbx_ael.o hashtab.o lock.o ael_main.o ast_expr2f.o ast_expr2.o strcompat.o pval.o extconf.o</span><br><span> </span><br><span>diff --git a/utils/ael_main.c b/utils/ael_main.c</span><br><span>index 0c6ec03..6c83746 100644</span><br><span>--- a/utils/ael_main.c</span><br><span>+++ b/utils/ael_main.c</span><br><span>@@ -381,7 +381,7 @@</span><br><span> if( dump_extensions ) {</span><br><span> struct namelist *x;</span><br><span> x = create_name((char*)value);</span><br><span style="color: hsl(0, 100%, 40%);">- strncpy(x->name2,data,100);</span><br><span style="color: hsl(120, 100%, 40%);">+ strncpy(x->name2, data, 99);</span><br><span> if( eval ) {</span><br><span> </span><br><span> ADD_LAST(con->switches,x);</span><br><span>diff --git a/utils/astman.c b/utils/astman.c</span><br><span>index 0ebedf8..b3c32dc 100644</span><br><span>--- a/utils/astman.c</span><br><span>+++ b/utils/astman.c</span><br><span>@@ -544,14 +544,15 @@</span><br><span> struct ast_chan *chan;</span><br><span> char dest[256];</span><br><span> struct message *m;</span><br><span style="color: hsl(120, 100%, 40%);">+ static const char tmp_prefix[] = "Enter new extension for ";</span><br><span> char channame[256];</span><br><span style="color: hsl(0, 100%, 40%);">- char tmp[80];</span><br><span style="color: hsl(120, 100%, 40%);">+ char tmp[sizeof(tmp_prefix) + sizeof(channame)];</span><br><span> char *context;</span><br><span> </span><br><span> chan = newtListboxGetCurrent(c);</span><br><span> if (chan) {</span><br><span> strncpy(channame, chan->name, sizeof(channame) - 1);</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(tmp, sizeof(tmp), "Enter new extension for %s", channame);</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(tmp, sizeof(tmp), "%s%s", tmp_prefix, channame);</span><br><span> if (get_user_input(tmp, dest, sizeof(dest)))</span><br><span> return;</span><br><span> if ((context = strchr(dest, '@'))) {</span><br><span>diff --git a/utils/db1-ast/hash/ndbm.c b/utils/db1-ast/hash/ndbm.c</span><br><span>index d702f73..16202ed 100644</span><br><span>--- a/utils/db1-ast/hash/ndbm.c</span><br><span>+++ b/utils/db1-ast/hash/ndbm.c</span><br><span>@@ -79,7 +79,7 @@</span><br><span> info.cachesize = 0;</span><br><span> info.hash = NULL;</span><br><span> info.lorder = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- (void)strncpy(path, file, len - 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ (void)strcpy(path, file); /* SAFE */</span><br><span> (void)strncat(path, DBM_SUFFIX, len - strlen(path) - 1);</span><br><span> db = (DBM *)__hash_open(path, flags, mode, &info, 0);</span><br><span> #ifndef __GNUC__</span><br><span>diff --git a/utils/extconf.c b/utils/extconf.c</span><br><span>index f6904ba..c7cc1d1 100644</span><br><span>--- a/utils/extconf.c</span><br><span>+++ b/utils/extconf.c</span><br><span>@@ -3181,7 +3181,7 @@</span><br><span> char *c;</span><br><span> char *cur = buf;</span><br><span> struct ast_variable *v;</span><br><span style="color: hsl(0, 100%, 40%);">- char cmd[512], exec_file[512];</span><br><span style="color: hsl(120, 100%, 40%);">+ char exec_file[512];</span><br><span> int object, do_exec, do_include;</span><br><span> </span><br><span> /* Actually parse the entry */</span><br><span>@@ -3295,8 +3295,14 @@</span><br><span> /* #exec </path/to/executable></span><br><span> We create a tmp file, then we #include it, then we delete it. */</span><br><span> if (do_exec) {</span><br><span style="color: hsl(120, 100%, 40%);">+ char cmd[1024];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> snprintf(exec_file, sizeof(exec_file), "/var/tmp/exec.%d.%ld", (int)time(NULL), (long)pthread_self());</span><br><span style="color: hsl(0, 100%, 40%);">- snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (snprintf(cmd, sizeof(cmd), "%s > %s 2>&1", cur, exec_file) >= sizeof(cmd)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Failed to construct command string to execute %s.\n", cur);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> ast_safe_system(cmd);</span><br><span> cur = exec_file;</span><br><span> } else</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9468">change 9468</a>. To unsubscribe, or for help writing mail filters, 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/9468"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/13.21 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84 </div>
<div style="display:none"> Gerrit-Change-Number: 9468 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>