Skip to content

Commit

Permalink
Merge pull request #171 from solarispika/fix/precompose-filename-fail…
Browse files Browse the repository at this point in the history
…-easily

Fix precomposeFileName buffer overflow issue
  • Loading branch information
SpartanJ committed Nov 23, 2023
2 parents aae269e + a0db6e9 commit bc85baf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/efsw/FileSystem.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cstring>
#include <efsw/FileSystem.hpp>
#include <efsw/platform/platformimpl.hpp>
#include <cstring>

#if EFSW_OS == EFSW_OS_MACOSX
#include <CoreFoundation/CoreFoundation.h>
Expand Down Expand Up @@ -107,7 +107,7 @@ std::string FileSystem::precomposeFileName( const std::string& name ) {
return std::string();
}

std::string result( maxSize, '\0' );
std::string result( maxSize + 1, '\0' );
if ( CFStringGetCString( cfMutable, &result[0], result.size(), kCFStringEncodingUTF8 ) ) {
result.resize( std::strlen( result.c_str() ) );
CFRelease( cfStringRef );
Expand Down

0 comments on commit bc85baf

Please sign in to comment.