aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/regex/src/cregex.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/cregex.cxx
parentaf8d1a0139ca105c6830f4ac7c320aca2e1c1f5e (diff)
Update internal Boost subset to 1.54.0
Diffstat (limited to 'cutl/details/boost/regex/src/cregex.cxx')
-rw-r--r--cutl/details/boost/regex/src/cregex.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/cutl/details/boost/regex/src/cregex.cxx b/cutl/details/boost/regex/src/cregex.cxx
index cf8154f..c64f993 100644
--- a/cutl/details/boost/regex/src/cregex.cxx
+++ b/cutl/details/boost/regex/src/cregex.cxx
@@ -361,11 +361,24 @@ void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
while(dstart != dend)
{
+ // Verify that sprintf will not overflow:
+ if(std::strlen(dstart.path()) + std::strlen(directory_iterator::separator()) + std::strlen(ptr) >= MAX_PATH)
+ {
+ // Oops overflow, skip this item:
+ ++dstart;
+ continue;
+ }
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
- (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+ int r = (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
#else
- (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+ int r = (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
#endif
+ if(r < 0)
+ {
+ // sprintf failed, skip this item:
+ ++dstart;
+ continue;
+ }
BuildFileList(pl, buf, recurse);
++dstart;
}