summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Elliott <elliott_c@ociweb.com>2022-12-06 09:12:37 -0600
committerChad Elliott <elliott_c@ociweb.com>2022-12-06 09:12:37 -0600
commitef617e3f28567a8bbb356829fa344f90bb7aea9a (patch)
tree81c039863887f865bf13a97d315b9fd72302d170
parent390ee1476a36465d8d70cdf5e315c8007fd3e357 (diff)
downloadATCD-ef617e3f28567a8bbb356829fa344f90bb7aea9a.tar.gz
Increased the final buffer size (in the info method) to accommodate the maximum possible string size. (ubuntu 20 - gcc 10 warning)
-rw-r--r--ACE/ace/Acceptor.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/ACE/ace/Acceptor.cpp b/ACE/ace/Acceptor.cpp
index b9246fc5e54..624e69cd82f 100644
--- a/ACE/ace/Acceptor.cpp
+++ b/ACE/ace/Acceptor.cpp
@@ -163,7 +163,6 @@ ACE_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::info (ACE_TCHAR **strp,
size_t length) const
{
ACE_TRACE ("ACE_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::info");
- ACE_TCHAR buf[BUFSIZ];
ACE_TCHAR addr_str[BUFSIZ];
typename PEER_ACCEPTOR::PEER_ADDR addr;
@@ -172,7 +171,17 @@ ACE_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::info (ACE_TCHAR **strp,
else if (addr.addr_to_string (addr_str, sizeof addr_str) == -1)
return -1;
- ACE_OS::snprintf (buf, BUFSIZ,
+ //
+ // gcc10 complains that it is possible that buf could be truncated by up to
+ // 35 bytes in this call to snprintf. Technically, this is possible
+ // (however unlikely that may be). Since addr_str is defined to be of size
+ // BUFSIZ, gcc assumes that the string could actually be BUFSIZ in length.
+ // That makes the possible total length of the combined string (given the
+ // size of the literal string constants) 3 + 12 + BUFSIZE + 19 + 1.
+ //
+ const size_t additional = 35;
+ ACE_TCHAR buf[BUFSIZ + additional];
+ ACE_OS::snprintf (buf, sizeof buf,
ACE_TEXT ("%s\t %s %s"),
ACE_TEXT ("ACE_Acceptor"),
addr_str,