summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2002-12-21 17:42:46 +0000
committerSteve Huston <shuston@riverace.com>2002-12-21 17:42:46 +0000
commit4eb60b4fdb67761da170e4ece6609dbe1f3b0fc2 (patch)
tree1073c1de1855c284bdfe6e7ab86037e14a7a3050 /ace
parentc2cf90113adb2168a98a67a5e7d6d12fa2e7dd21 (diff)
downloadATCD-4eb60b4fdb67761da170e4ece6609dbe1f3b0fc2.tar.gz
ChangeLogTag:Sat Dec 21 12:38:41 2002 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 6912d72b646..f6d94de214f 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -1056,6 +1056,9 @@ ACE_OS::snprintf (char *buf, size_t maxlen, const char *format, ...)
# if defined (ACE_WIN32)
ACE_OSCALL (ACE_SPRINTF_ADAPTER (::_vsnprintf (buf, maxlen, format, ap)),
int, -1, result);
+ // Win32 doesn't 0-terminate the string if it overruns maxlen.
+ if (result == -1)
+ buf[maxlen-1] = '\0';
# else
ACE_OSCALL (ACE_SPRINTF_ADAPTER (::vsnprintf (buf, maxlen, format, ap)),
int, -1, result);
@@ -1093,6 +1096,9 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...)
// as a substitute, which does have the same signature as the UNIX98 one.
ACE_OSCALL (ACE_SPRINTF_ADAPTER (::_vsnwprintf (buf, maxlen, format, ap)),
int, -1, result);
+ // Win32 doesn't 0-terminate the string if it overruns maxlen.
+ if (result == -1)
+ buf[maxlen-1] = '\0';
# else
ACE_OSCALL (ACE_SPRINTF_ADAPTER (::vswprintf (buf, maxlen, format, ap)),
int, -1, result);