mirror of
https://github.com/boostorg/regex.git
synced 2025-07-17 22:32:09 +02:00
Improve sprintf usage.
Stop passing UDT's through (...) even in meta programs. Fixes #5958. Refs #5835. [SVN r74897]
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user