diff libfdproto/messages.c @ 1442:915450ee91c7

fix gcc 9.1.1 compile warnings Use snprintf instead of strncpy to ensure NUL termination. Simplify attribute copying to calloc/memcpy instead of malloc/memset/strncpy/assignment. Appeases gcc 9.1.1 warnings about strncpy bounds.
author Luke Mewburn <luke@mewburn.net>
date Thu, 27 Feb 2020 16:19:24 +1100
parents 67c263056d78
children d25ce064c667
line wrap: on
line diff
--- a/libfdproto/messages.c	Tue Feb 25 10:42:08 2020 +1100
+++ b/libfdproto/messages.c	Thu Feb 27 16:19:24 2020 +1100
@@ -2234,7 +2234,7 @@
 				if (error_info) {				
 						error_info->pei_errcode = "DIAMETER_INVALID_AVP_VALUE";
 						error_info->pei_avp = avp;
-						strncpy(error_message, err, sizeof(error_message));
+						snprintf(error_message, sizeof(error_message), "%s", err);
 						error_info->pei_message = error_message;
 				} else {
 					char * buf = NULL;
"Welcome to our mercurial repository"