aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/regex/src/posix_api.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-10-19 08:57:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-10-19 08:57:20 +0200
commited6115361006240e3c7b02295599e4534cc55a13 (patch)
tree612f12d6c7c49421102041fceb7609db8ab8257e /cutl/details/boost/regex/src/posix_api.cxx
parentaf8d1a0139ca105c6830f4ac7c320aca2e1c1f5e (diff)
Update internal Boost subset to 1.54.0
Diffstat (limited to 'cutl/details/boost/regex/src/posix_api.cxx')
-rw-r--r--cutl/details/boost/regex/src/posix_api.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/cutl/details/boost/regex/src/posix_api.cxx b/cutl/details/boost/regex/src/posix_api.cxx
index 589a235..02d76bf 100644
--- a/cutl/details/boost/regex/src/posix_api.cxx
+++ b/cutl/details/boost/regex/src/posix_api.cxx
@@ -18,6 +18,7 @@
#define BOOST_REGEX_SOURCE
+#include <cutl/details/boost/config.hpp>
#include <cstdio>
#include <cutl/details/boost/regex.hpp>
#include <cutl/details/boost/cregex.hpp>
@@ -167,11 +168,17 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
{
if(std::strcmp(e->re_endp, names[i]) == 0)
{
+ //
+ // We're converting an integer i to a string, and since i <= REG_E_UNKNOWN
+ // a five character string is *always* large enough:
+ //
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
- (::sprintf_s)(localbuf, 5, "%d", i);
+ int r = (::sprintf_s)(localbuf, 5, "%d", i);
#else
- (std::sprintf)(localbuf, "%d", i);
+ int r = (std::sprintf)(localbuf, "%d", i);
#endif
+ if(r < 0)
+ return 0; // sprintf failed
if(std::strlen(localbuf) < buf_size)
re_detail::strcpy_s(buf, buf_size, localbuf);
return std::strlen(localbuf) + 1;