Mercurial > hg > freeDiameter
comparison 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 |
comparison
equal
deleted
inserted
replaced
1441:6029afe9bacb | 1442:915450ee91c7 |
---|---|
2232 if (ret != 0) { | 2232 if (ret != 0) { |
2233 TRACE_DEBUG(INFO, "The AVP failed to pass the dictionary validation"); | 2233 TRACE_DEBUG(INFO, "The AVP failed to pass the dictionary validation"); |
2234 if (error_info) { | 2234 if (error_info) { |
2235 error_info->pei_errcode = "DIAMETER_INVALID_AVP_VALUE"; | 2235 error_info->pei_errcode = "DIAMETER_INVALID_AVP_VALUE"; |
2236 error_info->pei_avp = avp; | 2236 error_info->pei_avp = avp; |
2237 strncpy(error_message, err, sizeof(error_message)); | 2237 snprintf(error_message, sizeof(error_message), "%s", err); |
2238 error_info->pei_message = error_message; | 2238 error_info->pei_message = error_message; |
2239 } else { | 2239 } else { |
2240 char * buf = NULL; | 2240 char * buf = NULL; |
2241 size_t buflen; | 2241 size_t buflen; |
2242 CHECK_MALLOC(fd_msg_dump_treeview(&buf, &buflen, NULL, avp, NULL, 0, 0)); | 2242 CHECK_MALLOC(fd_msg_dump_treeview(&buf, &buflen, NULL, avp, NULL, 0, 0)); |