mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-23 21:27:45 +00:00
Addressing unchecked iterator issues with core project
- std::equal can take a 2nd iterator end - use _SCL_SECURE_NO_WARNINGS for std::copy issues in exd_common_gen
This commit is contained in:
parent
09d565a854
commit
5f38a17663
2 changed files with 6 additions and 3 deletions
|
@ -597,7 +597,7 @@ int main(int argc, char* argv[])
|
||||||
auto path = boost::filesystem::canonical( web_root_path / "news.xml" );
|
auto path = boost::filesystem::canonical( web_root_path / "news.xml" );
|
||||||
//Check if path is within web_root_path
|
//Check if path is within web_root_path
|
||||||
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
||||||
!equal( web_root_path.begin(), web_root_path.end(), path.begin() ) )
|
!std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) )
|
||||||
throw invalid_argument( "path must be within root path" );
|
throw invalid_argument( "path must be within root path" );
|
||||||
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
|
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
|
||||||
throw invalid_argument( "file does not exist" );
|
throw invalid_argument( "file does not exist" );
|
||||||
|
@ -638,7 +638,7 @@ int main(int argc, char* argv[])
|
||||||
auto path = boost::filesystem::canonical( web_root_path / "headlines.xml" );
|
auto path = boost::filesystem::canonical( web_root_path / "headlines.xml" );
|
||||||
//Check if path is within web_root_path
|
//Check if path is within web_root_path
|
||||||
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
||||||
!equal( web_root_path.begin(), web_root_path.end(), path.begin() ) )
|
!std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) )
|
||||||
throw invalid_argument( "path must be within root path" );
|
throw invalid_argument( "path must be within root path" );
|
||||||
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
|
if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) )
|
||||||
throw invalid_argument( "file does not exist" );
|
throw invalid_argument( "file does not exist" );
|
||||||
|
@ -683,7 +683,7 @@ int main(int argc, char* argv[])
|
||||||
auto path = boost::filesystem::canonical( web_root_path / request->path );
|
auto path = boost::filesystem::canonical( web_root_path / request->path );
|
||||||
//Check if path is within web_root_path
|
//Check if path is within web_root_path
|
||||||
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) ||
|
||||||
!equal( web_root_path.begin(), web_root_path.end(), path.begin() ) )
|
!std::equal( web_root_path.begin(), web_root_path.end(), path.begin(), path.end() ) )
|
||||||
throw invalid_argument( "path must be within root path" );
|
throw invalid_argument( "path must be within root path" );
|
||||||
if( boost::filesystem::is_directory( path ) )
|
if( boost::filesystem::is_directory( path ) )
|
||||||
path /= "index.html";
|
path /= "index.html";
|
||||||
|
|
|
@ -27,6 +27,9 @@ if (UNIX)
|
||||||
target_link_libraries (exd_common_gen Common xivdat pthread mysqlclient dl z)
|
target_link_libraries (exd_common_gen Common xivdat pthread mysqlclient dl z)
|
||||||
else()
|
else()
|
||||||
target_link_libraries (exd_common_gen Common xivdat libmysql zlib1)
|
target_link_libraries (exd_common_gen Common xivdat libmysql zlib1)
|
||||||
|
|
||||||
|
# ignore unchecked iterators warnings from msvc
|
||||||
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(exd_common_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES})
|
target_link_libraries(exd_common_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES})
|
||||||
|
|
Loading…
Add table
Reference in a new issue