[Asterisk-code-review] Fix GCC 8 build issues. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Mon May 7 10:49:32 CDT 2018


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/8934


Change subject: Fix GCC 8 build issues.
......................................................................

Fix GCC 8 build issues.

This fixes build warnings found by GCC 8.  In some cases format
truncation is intentional so the warning is just suppressed.

ASTERISK-27824 #close

Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
---
M addons/Makefile
M apps/Makefile
M apps/app_minivm.c
M apps/app_queue.c
M apps/app_sms.c
M apps/app_test.c
M apps/app_voicemail.c
M channels/Makefile
M channels/chan_dahdi.c
M channels/chan_iax2.c
M channels/chan_sip.c
M channels/chan_skinny.c
M channels/iax2/parser.c
M configure
M configure.ac
M funcs/func_groupcount.c
M main/config.c
M main/manager.c
M main/pbx.c
M makeopts.in
M pbx/dundi-parser.c
M pbx/pbx_dundi.c
M res/Makefile
M res/res_config_ldap.c
M res/res_musiconhold.c
M res/res_pjsip/pjsip_resolver.c
M tests/Makefile
M tests/test_voicemail_api.c
M utils/Makefile
M utils/ael_main.c
M utils/astman.c
M utils/db1-ast/hash/ndbm.c
M utils/extconf.c
33 files changed, 98 insertions(+), 58 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/34/8934/1

diff --git a/addons/Makefile b/addons/Makefile
index 47da132..866d34b 100644
--- a/addons/Makefile
+++ b/addons/Makefile
@@ -59,6 +59,7 @@
 
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
+chan_mobile.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
 chan_ooh323.so: _ASTCFLAGS+=$(H323CFLAGS)
 $(call MOD_ADD_C,chan_ooh323,$(H323SOURCE))
 
diff --git a/apps/Makefile b/apps/Makefile
index a53bbe2..589293c 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -29,7 +29,11 @@
 
 $(call MOD_ADD_C,app_confbridge,$(wildcard confbridge/*.c))
 
+app_confbridge.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+app_meetme.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+app_minivm.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
 app_voicemail.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+app_while.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
 
 ifneq ($(findstring $(OSARCH), mingw32 cygwin ),)
   LIBS+= -lres_ael_share.so -lres_monitor.so -lres_speech.so
diff --git a/apps/app_minivm.c b/apps/app_minivm.c
index c09fba1..2a8c8b5 100644
--- a/apps/app_minivm.c
+++ b/apps/app_minivm.c
@@ -2786,11 +2786,11 @@
 	       switch (tmpwrite[1]) {
 	       case 'n':
 		      memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
-		      strncpy(tmpwrite, "\n", len);
+		      strcpy(tmpwrite, "\n"); /* SAFE */
 		      break;
 	       case 't':
 		      memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
-		      strncpy(tmpwrite, "\t", len);
+		      strcpy(tmpwrite, "\t"); /* SAFE */
 		      break;
 	       default:
 		      ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);
diff --git a/apps/app_queue.c b/apps/app_queue.c
index e7779b7..09690ec 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -6581,7 +6581,7 @@
 static void setup_mixmonitor(struct queue_ent *qe, const char *filename)
 {
 	char escaped_filename[256];
-	char file_with_ext[256];
+	char file_with_ext[264];
 	char mixmonargs[1512];
 	char escaped_monitor_exec[1024];
 	const char *monitor_options;
diff --git a/apps/app_sms.c b/apps/app_sms.c
index c50a686..0e37971 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -1214,7 +1214,7 @@
 {
 	struct ast_tm tm;
 	struct timeval now = h->scts;
-	char stm[9];
+	char stm[45];
 
 	h->omsg[0] = 0x00;                      /* set later... */
 	h->omsg[1] = 0;
diff --git a/apps/app_test.c b/apps/app_test.c
index 7981dbd..5b528b0 100644
--- a/apps/app_test.c
+++ b/apps/app_test.c
@@ -330,7 +330,7 @@
 {
 	int res = 0;
 	char testid[80]="";
-	char fn[80];
+	char fn[104];
 	FILE *f;
 	if (ast_channel_state(chan) != AST_STATE_UP)
 		res = ast_answer(chan);
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c4df4dc..c3bfeb4 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1025,7 +1025,7 @@
 	int old_new;
 	int old_old;
 	char *uniqueid;
-	char mailbox[1];
+	char mailbox[0];
 };
 
 struct mwi_sub_task {
@@ -13140,7 +13140,7 @@
 	struct mwi_sub *mwi_sub;
 	struct mwi_sub_task *p = datap;
 
-	len = sizeof(*mwi_sub);
+	len = sizeof(*mwi_sub) + 1;
 	if (!ast_strlen_zero(p->mailbox))
 		len += strlen(p->mailbox);
 
diff --git a/channels/Makefile b/channels/Makefile
index 9f6f9d6..6398d95 100644
--- a/channels/Makefile
+++ b/channels/Makefile
@@ -30,6 +30,9 @@
 $(call MOD_ADD_C,chan_misdn,misdn_config.c misdn/isdn_lib.c misdn/isdn_msg_parser.c)
 
 chan_mgcp.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+chan_unistim.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+chan_phone.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+chan_sip.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
 
 chan_misdn.o: _ASTCFLAGS+=-Imisdn
 misdn_config.o: _ASTCFLAGS+=-Imisdn
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 7c54cf3..34aed16 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1781,7 +1781,7 @@
  */
 static void dahdi_ami_channel_event(struct dahdi_pvt *p, struct ast_channel *chan)
 {
-	char ch_name[20];
+	char ch_name[23];
 
 	if (p->channel < CHAN_PSEUDO) {
 		/* No B channel */
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index dec9dfd..0deaaf0 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -14303,7 +14303,7 @@
 static int iax2_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
 {
 	char odata[256];
-	char req[256];
+	char req[263];
 	char *ncontext;
 	struct iax2_dpcache *dp = NULL;
 	struct ast_app *dial = NULL;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 46f9ad6..05509b2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11893,7 +11893,7 @@
 	int start = 0;
 
 	for (;;) {
-		char new[512];
+		char new[535];
 		const char *oh = __get_header(orig, field, &start);
 
 		if (ast_strlen_zero(oh))
@@ -14592,7 +14592,7 @@
 	struct ast_party_id diverting_from;
 	const char *reason;
 	const char *quote_str;
-	char header_text[256];
+	char header_text[538];
 	char encoded_number[SIPBUFSIZE/2];
 
 	/* We skip this entirely if the configuration doesn't allow diversion headers */
@@ -17399,7 +17399,7 @@
 	{
 		char a2[256];
 		char a2_hash[256];
-		char resp[256];
+		char resp[513];
 
 		snprintf(a2, sizeof(a2), "%s:%s", sip_methods[sipmethod].text,
 				S_OR(keys[K_URI].s, uri));
@@ -23010,10 +23010,10 @@
 static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int digest_len)
 {
 	char a1[256];
-	char a2[256];
+	char a2[257];
 	char a1_hash[256];
 	char a2_hash[256];
-	char resp[256];
+	char resp[607];
 	char resp_hash[256];
 	char uri[256];
 	char opaque[256] = "";
@@ -35199,21 +35199,22 @@
 	struct ast_str *overflow;
 	struct {
 		char **fragments;
+		size_t fragment_count;
 		char **expected;
 		int num_expected;
 		const char *description;
 	} tests[] = {
-		{ normal, normal, 1, "normal" },
-		{ fragmented, normal, 1, "fragmented" },
-		{ fragmented_body, normal, 1, "fragmented_body" },
-		{ multi_fragment, normal, 1, "multi_fragment" },
-		{ multi_message, multi_message_divided, 2, "multi_message" },
-		{ multi_message_body, multi_message_body_divided, 2, "multi_message_body" },
-		{ multi_message_in_fragments, multi_message_divided, 2, "multi_message_in_fragments" },
-		{ compact, compact, 1, "compact" },
-		{ faux, faux, 1, "faux" },
-		{ folded, folded, 1, "folded" },
-		{ cl_in_body, cl_in_body, 1, "cl_in_body" },
+		{ normal, ARRAY_LEN(normal), normal, 1, "normal" },
+		{ fragmented, ARRAY_LEN(fragmented), normal, 1, "fragmented" },
+		{ fragmented_body, ARRAY_LEN(fragmented_body), normal, 1, "fragmented_body" },
+		{ multi_fragment, ARRAY_LEN(multi_fragment), normal, 1, "multi_fragment" },
+		{ multi_message, ARRAY_LEN(multi_message), multi_message_divided, 2, "multi_message" },
+		{ multi_message_body, ARRAY_LEN(multi_message_body), multi_message_body_divided, 2, "multi_message_body" },
+		{ multi_message_in_fragments, ARRAY_LEN(multi_message_in_fragments), multi_message_divided, 2, "multi_message_in_fragments" },
+		{ compact, ARRAY_LEN(compact), compact, 1, "compact" },
+		{ faux, ARRAY_LEN(faux), faux, 1, "faux" },
+		{ folded, ARRAY_LEN(folded), folded, 1, "folded" },
+		{ cl_in_body, ARRAY_LEN(cl_in_body), cl_in_body, 1, "cl_in_body" },
 	};
 	int i;
 	enum ast_test_result_state res = AST_TEST_PASS;
@@ -35241,7 +35242,7 @@
 	}
 	for (i = 0; i < ARRAY_LEN(tests); ++i) {
 		int num_messages = 0;
-		if (mock_tcp_loop(tests[i].fragments, ARRAY_LEN(tests[i].fragments),
+		if (mock_tcp_loop(tests[i].fragments, tests[i].fragment_count,
 					&overflow, tests[i].expected, &num_messages, test)) {
 			ast_test_status_update(test, "Failed to parse message '%s'\n", tests[i].description);
 			res = AST_TEST_FAIL;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 0093a1f..eed2ffa 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -3706,49 +3706,49 @@
 	int posn = 0;
 
 	ptr = dbgcli_buf;
-	strncpy(ptr, "\0", 1);
+	ptr[0] = '\0';
 	if (skinnydebug & DEBUG_GENERAL) {
-		strncpy(ptr, "general ", 8);
+		strcpy(ptr, "general "); /* SAFE */
 		posn += 8;
 		ptr += 8;
 	}
 	if (skinnydebug & DEBUG_SUB) {
-		strncpy(ptr, "sub ", 4);
+		strcpy(ptr, "sub "); /* SAFE */
 		posn += 4;
 		ptr += 4;
 	}
 	if (skinnydebug & DEBUG_AUDIO) {
-		strncpy(ptr, "audio ", 6);
+		strcpy(ptr, "audio "); /* SAFE */
 		posn += 6;
 		ptr += 6;
 	}
 	if (skinnydebug & DEBUG_PACKET) {
-		strncpy(ptr, "packet ", 7);
+		strcpy(ptr, "packet "); /* SAFE */
 		posn += 7;
 		ptr += 7;
 	}
 	if (skinnydebug & DEBUG_LOCK) {
-		strncpy(ptr, "lock ", 5);
+		strcpy(ptr, "lock "); /* SAFE */
 		posn += 5;
 		ptr += 5;
 	}
 	if (skinnydebug & DEBUG_TEMPLATE) {
-		strncpy(ptr, "template ", 9);
+		strcpy(ptr, "template "); /* SAFE */
 		posn += 9;
 		ptr += 9;
 	}
 	if (skinnydebug & DEBUG_THREAD) {
-		strncpy(ptr, "thread ", 7);
+		strcpy(ptr, "thread "); /* SAFE */
 		posn += 7;
 		ptr += 7;
 	}
 	if (skinnydebug & DEBUG_HINT) {
-		strncpy(ptr, "hint ", 5);
+		strcpy(ptr, "hint "); /* SAFE */
 		posn += 5;
 		ptr += 5;
 	}
 	if (skinnydebug & DEBUG_KEEPALIVE) {
-		strncpy(ptr, "keepalive ", 10);
+		strcpy(ptr, "keepalive "); /* SAFE */
 		posn += 10;
 		ptr += 10;
 	}
@@ -6427,7 +6427,7 @@
 	case STIMULUS_CALLPARK:
 		{
 		char extout[AST_MAX_EXTENSION];
-		char message[32];
+		char message[96];
 		RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
 		SKINNY_DEBUG(DEBUG_PACKET, 3, "Received STIMULUS_CALLPARK from %s, inst %d, callref %d\n",
 			d->name, instance, callreference);
@@ -7180,7 +7180,7 @@
 	case SOFTKEY_PARK:
 		{
 		char extout[AST_MAX_EXTENSION];
-		char message[32];
+		char message[96];
 		RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
 		SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_PARK from %s, inst %d, callref %d\n",
 			d->name, instance, callreference);
diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c
index 8880b92..b94d306 100644
--- a/channels/iax2/parser.c
+++ b/channels/iax2/parser.c
@@ -415,7 +415,7 @@
 	int x;
 	int found;
 	char interp[1024];
-	char tmp[1024];
+	char tmp[1046];
 
 	if (len < 2)
 		return;
diff --git a/configure b/configure
index c1a06e8..223bd05 100755
--- a/configure
+++ b/configure
@@ -686,6 +686,7 @@
 AST_RPATH
 AST_NATIVE_ARCH
 AST_SHADOW_WARNINGS
+AST_NO_STRINGOP_TRUNCATION
 AST_NO_FORMAT_TRUNCATION
 AST_NO_STRICT_OVERFLOW
 AST_FORTIFY_SOURCE
@@ -18380,6 +18381,19 @@
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wno-stringop-truncation" >&5
+$as_echo_n "checking for -Wno-stringop-truncation... " >&6; }
+if $(${CC} -Wno-stringop-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	AST_NO_STRINGOP_TRUNCATION=-Wno-stringop-truncation
+else
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	AST_NO_STRINGOP_TRUNCATION=
+fi
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5
 $as_echo_n "checking for -Wshadow... " >&6; }
 if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
diff --git a/configure.ac b/configure.ac
index e94febe..16459e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1276,6 +1276,16 @@
 fi
 AC_SUBST(AST_NO_FORMAT_TRUNCATION)
 
+AC_MSG_CHECKING(for -Wno-stringop-truncation)
+if $(${CC} -Wno-stringop-truncation -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+	AC_MSG_RESULT(yes)
+	AST_NO_STRINGOP_TRUNCATION=-Wno-stringop-truncation
+else
+	AC_MSG_RESULT(no)
+	AST_NO_STRINGOP_TRUNCATION=
+fi
+AC_SUBST(AST_NO_STRINGOP_TRUNCATION)
+
 AC_MSG_CHECKING(for -Wshadow)
 if $(${CC} -Wshadow -Werror -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
 	AC_MSG_RESULT(yes)
diff --git a/funcs/func_groupcount.c b/funcs/func_groupcount.c
index f6dd5c6..e74df7e 100644
--- a/funcs/func_groupcount.c
+++ b/funcs/func_groupcount.c
@@ -241,7 +241,7 @@
 				    char *data, char *buf, size_t len)
 {
 	struct ast_group_info *gi = NULL;
-	char tmp1[1024] = "";
+	char tmp1[1026] = "";
 	char tmp2[1024] = "";
 
 	if (!chan)
diff --git a/main/config.c b/main/config.c
index f7f0d7b..acf227c 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1734,7 +1734,8 @@
 	char *c;
 	char *cur = buf;
 	struct ast_variable *v;
-	char cmd[512], exec_file[512];
+	char cmd[520];
+	char exec_file[512];
 
 	/* Actually parse the entry */
 	if (cur[0] == '[') { /* A category header */
diff --git a/main/manager.c b/main/manager.c
index 577c7f9..2ddaab2 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -8007,7 +8007,7 @@
 	/* compute the expected response to compare with what we received */
 	{
 		char a2[256];
-		char a2_hash[256];
+		char a2_hash[33];
 		char resp[256];
 
 		/* XXX Now request method are hardcoded in A2 */
diff --git a/main/pbx.c b/main/pbx.c
index 70e72fe..727018b 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6235,7 +6235,7 @@
 	char *last_presence_message;
 
 	AST_LIST_ENTRY(store_hint) list;
-	char data[1];
+	char data[0];
 };
 
 AST_LIST_HEAD_NOLOCK(store_hints, store_hint);
diff --git a/makeopts.in b/makeopts.in
index 1063316..0f9ebe0 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -119,6 +119,7 @@
 AST_TRAMPOLINES=@AST_TRAMPOLINES@
 AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
 AST_NO_FORMAT_TRUNCATION=@AST_NO_FORMAT_TRUNCATION@
+AST_NO_STRINGOP_TRUNCATION=@AST_NO_STRINGOP_TRUNCATION@
 AST_SHADOW_WARNINGS=@AST_SHADOW_WARNINGS@
 AST_NESTED_FUNCTIONS=@AST_NESTED_FUNCTIONS@
 AST_CLANG_BLOCKS=@AST_CLANG_BLOCKS@
diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c
index 856f4ae..808559c 100644
--- a/pbx/dundi-parser.c
+++ b/pbx/dundi-parser.c
@@ -386,7 +386,7 @@
 	int x;
 	int found;
 	char interp[1024];
-	char tmp[1024];
+	char tmp[1051];
 	if (len < 2)
 		return;
 	while(len >= 2) {
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 92e7198..12041d3 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -1237,7 +1237,7 @@
 
 static int cache_lookup(struct dundi_request *req, dundi_eid *peer_eid, uint32_t crc, int *lowexpiration)
 {
-	char key[256];
+	char key[382];
 	char eid_str[20];
 	char eidroot_str[20];
 	time_t now;
diff --git a/res/Makefile b/res/Makefile
index ec3417b..5ff38ad 100644
--- a/res/Makefile
+++ b/res/Makefile
@@ -29,7 +29,7 @@
 res_config_ldap.o: _ASTCFLAGS+=-DLDAP_DEPRECATED
 
 ael/ael_lex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h
-ael/ael_lex.o: _ASTCFLAGS+=-I. -Iael -Wno-unused
+ael/ael_lex.o: _ASTCFLAGS+=-I. -Iael -Wno-unused $(AST_NO_FORMAT_TRUNCATION)
 
 ael/ael.tab.o: ael/ael.tab.c ael/ael.tab.h ../include/asterisk/ael_structs.h
 ael/ael.tab.o: _ASTCFLAGS+=-I. -Iael -DYYENABLE_NLS=0
@@ -70,5 +70,7 @@
 $(call MOD_ADD_C,res_ari_model,ari/ari_model_validators.c)
 $(call MOD_ADD_C,res_stasis_recording,stasis_recording/stored.c)
 
+res_parking.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION)
+
 # Dependencies for res_ari_*.so are generated, so they're in this file
 include ari.make
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index d73f42b..14cde64 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1959,9 +1959,9 @@
  */
 static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	char status[256];
-	char credentials[100] = "";
-	char buf[362]; /* 256+100+" for "+NULL */
+	char status[1047];
+	char credentials[sizeof(user) + 15] = "";
+	char buf[sizeof(status) + sizeof(credentials) + 6];
 	int ctimesec = time(NULL) - connect_time;
 
 	switch (cmd) {
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 1c8728c..6caf6e0 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1142,7 +1142,7 @@
 
 	DIR *files_DIR;
 	struct dirent *files_dirent;
-	char dir_path[PATH_MAX];
+	char dir_path[PATH_MAX - 256];
 	char filepath[PATH_MAX];
 	char *ext;
 	struct stat statbuf;
diff --git a/res/res_pjsip/pjsip_resolver.c b/res/res_pjsip/pjsip_resolver.c
index d6646d5..930fb12 100644
--- a/res/res_pjsip/pjsip_resolver.c
+++ b/res/res_pjsip/pjsip_resolver.c
@@ -469,7 +469,7 @@
 	int ip_addr_ver;
 	pjsip_transport_type_e type = target->type;
 	struct sip_resolve *resolve;
-	char host[NI_MAXHOST];
+	char host[NI_MAXHOST - 11];
 	int res = 0;
 
 	ast_copy_pj_str(host, &target->addr.host, sizeof(host));
diff --git a/tests/Makefile b/tests/Makefile
index a65b88b..8ce37ff 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -18,3 +18,5 @@
 all: _all
 
 include $(ASTTOPDIR)/Makefile.moddir_rules
+
+test_strings.o: _ASTCFLAGS+=$(AST_NO_FORMAT_TRUNCATION) $(AST_NO_STRINGOP_TRUNCATION)
diff --git a/tests/test_voicemail_api.c b/tests/test_voicemail_api.c
index e467572..bcebba5 100644
--- a/tests/test_voicemail_api.c
+++ b/tests/test_voicemail_api.c
@@ -445,7 +445,7 @@
 static int test_vm_api_create_voicemail_files(const char *context, const char *mailbox, struct ast_vm_msg_snapshot *snapshot)
 {
 	FILE *msg_file;
-	char folder_path[PATH_MAX];
+	char folder_path[PATH_MAX - 12];
 	char msg_path[PATH_MAX];
 	char snd_path[PATH_MAX];
 	char beep_path[PATH_MAX];
@@ -538,7 +538,7 @@
 {
 	char msg_path[PATH_MAX];
 	char snd_path[PATH_MAX];
-	char folder_path[PATH_MAX];
+	char folder_path[PATH_MAX - 12];
 
 	if (!snapshot) {
 		return;
diff --git a/utils/Makefile b/utils/Makefile
index ae2af08..6bd33da 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -163,7 +163,7 @@
 	$(CMD_PREFIX) sed 's/ast_debug([[:digit:]][[:digit:]]*/ast_log(LOG_DEBUG/' "$@" > "$@.new"
 	$(CMD_PREFIX) mv "$@.new" "$@"
 
-aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused
+aelparse.o: _ASTCFLAGS+=-I$(ASTTOPDIR)/res -Wno-unused $(AST_NO_FORMAT_TRUNCATION)
 aelparse: LIBS+=-lm $(AST_CLANG_BLOCKS_LIBS)
 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 astmm.o
 
diff --git a/utils/ael_main.c b/utils/ael_main.c
index f4521e1..e0e4501 100644
--- a/utils/ael_main.c
+++ b/utils/ael_main.c
@@ -374,7 +374,7 @@
 	if( dump_extensions ) {
 		struct namelist *x;
 		x = create_name((char*)value);
-		strncpy(x->name2,data,100);
+		strncpy(x->name2, data, 99);
 		if( eval ) {
 
 			ADD_LAST(con->switches,x);
diff --git a/utils/astman.c b/utils/astman.c
index d4757d0..89ba240 100644
--- a/utils/astman.c
+++ b/utils/astman.c
@@ -531,7 +531,7 @@
 	char dest[256];
 	struct message *m;
 	char channame[256];
-	char tmp[80];
+	char tmp[280];
 	char *context;
 
 	chan = newtListboxGetCurrent(c);
diff --git a/utils/db1-ast/hash/ndbm.c b/utils/db1-ast/hash/ndbm.c
index d702f73..16202ed 100644
--- a/utils/db1-ast/hash/ndbm.c
+++ b/utils/db1-ast/hash/ndbm.c
@@ -79,7 +79,7 @@
 	info.cachesize = 0;
 	info.hash = NULL;
 	info.lorder = 0;
-	(void)strncpy(path, file, len - 1);
+	(void)strcpy(path, file); /* SAFE */
 	(void)strncat(path, DBM_SUFFIX, len - strlen(path) - 1);
 	db = (DBM *)__hash_open(path, flags, mode, &info, 0);
 #ifndef	__GNUC__
diff --git a/utils/extconf.c b/utils/extconf.c
index 541cbf8..b5ec25f 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -2918,7 +2918,8 @@
 	char *c;
 	char *cur = buf;
 	struct ast_variable *v;
-	char cmd[512], exec_file[512];
+	char cmd[520];
+	char exec_file[512];
 	int object, do_exec, do_include;
 
 	/* Actually parse the entry */

-- 
To view, visit https://gerrit.asterisk.org/8934
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I724f146cbddba8b86619d4c4a9931ee877995c84
Gerrit-Change-Number: 8934
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180507/3ff1295b/attachment-0001.html>


More information about the asterisk-code-review mailing list