mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
Fix buffer underrun found with address sanitizer
When subpath is the empty string, the code was reading from subPath[-1]
This commit is contained in:
parent
74a05854d5
commit
eabff49a6a
1 changed files with 4 additions and 2 deletions
|
|
@ -1306,8 +1306,10 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
|
|||
// Compose our search string - Format : ([path]/[subpath]/*)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
char trail = basePath[ dStrlen(basePath) - 1 ];
|
||||
char subTrail = subPath ? subPath[ dStrlen(subPath) - 1 ] : '\0';
|
||||
dsize_t trLen = basePath ? dStrlen(basePath) : 0;
|
||||
dsize_t subtrLen = subPath ? dStrlen(subPath) : 0;
|
||||
char trail = trLen > 0 ? basePath[ trLen - 1 ] : '\0';
|
||||
char subTrail = subtrLen > 0 ? subPath[ subtrLen - 1 ] : '\0';
|
||||
|
||||
if( trail == '/' )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue