summaryrefslogtreecommitdiff
path: root/ACE/ace/Acceptor.cpp
diff options
context:
space:
mode:
authorocielliottc <elliottc@objectcomputing.com>2022-12-06 13:45:59 -0600
committerGitHub <noreply@github.com>2022-12-06 13:45:59 -0600
commita824af374a4ed77a7a4f603675680e395b87cdc9 (patch)
tree81c039863887f865bf13a97d315b9fd72302d170 /ACE/ace/Acceptor.cpp
parent2f89988cf4227972a7e67d88d56ac5f0f81d1d25 (diff)
parentef617e3f28567a8bbb356829fa344f90bb7aea9a (diff)
downloadATCD-a824af374a4ed77a7a4f603675680e395b87cdc9.tar.gz
Merge pull request #1986 from DOCGroup/elliottc/715-fix-warnings
[ace6tao2] Fix build warnings (as shown by builds for OpenDDS)
Diffstat (limited to 'ACE/ace/Acceptor.cpp')
-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,