Skip to content

Commit d762dbe

Browse files
Path/Buffer improvements
Good changes
2 parents dc4878c + 11dce85 commit d762dbe

26 files changed

Lines changed: 1134 additions & 2548 deletions

src/cache.cpp

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,16 @@ void CCacheData::PrematureDeleteByPlugin(CPluginInterfaceAbstract* ownDeletePlug
326326

327327
CCacheDirData::CCacheDirData(const char* path) : Names(100, 50)
328328
{
329+
Path[0] = 0;
330+
PathLength = 0;
329331
int l = (int)strlen(path);
330332
if (l > 0 && path[l - 1] == '\\')
331333
l--;
334+
if (l >= MAX_PATH - 1)
335+
{
336+
TRACE_E("CCacheDirData::CCacheDirData(): path is too long.");
337+
return;
338+
}
332339
memcpy(Path, path, l);
333340
if (l > 0)
334341
Path[l++] = '\\';
@@ -345,9 +352,11 @@ CCacheDirData::~CCacheDirData()
345352
delete name;
346353
}
347354
if (PathLength > 0)
355+
{
348356
Path[PathLength - 1] = 0; // trimming a backslash
349-
SetFileAttributesUtf8(Path, FILE_ATTRIBUTE_ARCHIVE);
350-
RemoveDirectoryUtf8(Path);
357+
SetFileAttributesUtf8(Path, FILE_ATTRIBUTE_ARCHIVE);
358+
RemoveDirectoryUtf8(Path);
359+
}
351360
}
352361

353362
BOOL CCacheDirData::ContainTmpName(const char* tmpName, const char* rootTmpPath,
@@ -356,6 +365,8 @@ BOOL CCacheDirData::ContainTmpName(const char* tmpName, const char* rootTmpPath,
356365
CALL_STACK_MESSAGE2("CCacheDirData::ContainTmpName(%s, , ,)", tmpName);
357366

358367
*canContainThisName = FALSE;
368+
if (PathLength <= 0)
369+
return FALSE;
359370
if (rootTmpPathLen < PathLength &&
360371
StrNICmp(Path, rootTmpPath, rootTmpPathLen) == 0)
361372
{
@@ -470,6 +481,8 @@ void CCacheDirData::RemoveEmptyTmpDirsOnlyFromDisk()
470481
{
471482
CALL_STACK_MESSAGE1("CCacheDirData::RemoveEmptyTmpDirsOnlyFromDisk()");
472483

484+
if (PathLength <= 0)
485+
return;
473486
if (PathLength > 0)
474487
Path[PathLength - 1] = 0; // backslash trimming
475488
CStrP pathW(ConvertAllocUtf8ToWide(Path, -1));
@@ -486,6 +499,8 @@ BOOL CCacheDirData::GetName(CDiskCache* monitor, const char* name, BOOL* exists,
486499
BOOL canBlock, BOOL onlyAdd, int* errorCode)
487500
{
488501
CALL_STACK_MESSAGE4("CCacheDirData::GetName(, %s, , , %d, %d,)", name, canBlock, onlyAdd);
502+
if (PathLength <= 0)
503+
return FALSE;
489504
int i;
490505
if (errorCode != NULL)
491506
*errorCode = DCGNE_SUCCESS;
@@ -508,6 +523,14 @@ CCacheDirData::GetName(const char* name, const char* tmpName, BOOL* exists, BOOL
508523
CALL_STACK_MESSAGE4("CCacheDirData::GetName(%s, %s, , %d, ,)", name, tmpName, ownDelete);
509524
if (errorCode != NULL)
510525
*errorCode = DCGNE_SUCCESS;
526+
if (PathLength <= 0)
527+
{
528+
TRACE_E("CCacheDirData::GetName(): invalid tmp-directory path.");
529+
*exists = TRUE;
530+
if (errorCode != NULL)
531+
*errorCode = DCGNE_TOOLONGNAME;
532+
return NULL;
533+
}
511534
char tmpFullName[MAX_PATH];
512535
memcpy(tmpFullName, Path, PathLength);
513536
if (PathLength + strlen(tmpName) + 1 <= MAX_PATH)
@@ -653,6 +676,8 @@ void CCacheDirData::AddVictimsToArray(TDirectArray<CCacheData*>& victArr)
653676

654677
BOOL CCacheDirData::DetachTmpFile(const char* tmpName)
655678
{
679+
if (PathLength <= 0)
680+
return FALSE;
656681
if (StrNICmp(tmpName, Path, PathLength) == 0) // if there's a chance that this is our tmp-file
657682
{
658683
int i;
@@ -1182,7 +1207,7 @@ CDiskCache::GetName(const char* name, const char* tmpName, BOOL* exists, BOOL on
11821207
if (rootTmpPath != NULL &&
11831208
(SalCheckPath(TRUE, sysTmpDir, ERROR_SUCCESS, TRUE, MainWindow->HWindow) != ERROR_SUCCESS ||
11841209
!CheckAndCreateDirectory(rootTmpPath, NULL, TRUE)) || // if it's not TEMP, tmp-root must be verified and created, if needed
1185-
!SalGetTempFileName(rootTmpPath, "SAL", newDirPath, FALSE))
1210+
!SalGetTempFileName(rootTmpPath, "SAL", newDirPath, _countof(newDirPath), FALSE))
11861211
{
11871212
*exists = TRUE; // fatal error
11881213
Leave();

src/consts.h

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ class CEnterCriticalSection
9595

9696
// because Windows GetTempFileName doesn't work, we wrote our own clone:
9797
// creates file/directory (based on 'file') at path 'path' (NULL -> Windows TEMP dir),
98-
// with prefix 'prefix', returns name of created file in 'tmpName' (min. size MAX_PATH),
98+
// with prefix 'prefix', returns name of created file in 'tmpName' (size in 'tmpNameLen'),
9999
// returns "success?" (on failure returns Windows error code via SetLastError - for compatibility)
100+
BOOL SalGetTempFileName(const char* path, const char* prefix, char* tmpName, int tmpNameLen, BOOL file);
101+
// legacy compatibility overload ('tmpName' must be at least MAX_PATH)
100102
BOOL SalGetTempFileName(const char* path, const char* prefix, char* tmpName, BOOL file);
101103

102104
// because Windows MoveFile can't rename files with read-only attribute on Novell,
@@ -153,6 +155,8 @@ BOOL IsNOVELLDrive(const char* path);
153155
// whether file size check is needed after copying); for optimization
154156
// purposes uses 'lastLantasticCheckRoot' (for first call "", then don't change)
155157
// and 'lastIsLantasticPath' (result for 'lastLantasticCheckRoot')
158+
BOOL IsLantasticDrive(const char* path, char* lastLantasticCheckRoot, int lastLantasticCheckRootBufSize, BOOL& lastIsLantasticPath);
159+
// legacy compatibility overload ('lastLantasticCheckRoot' must be at least MAX_PATH)
156160
BOOL IsLantasticDrive(const char* path, char* lastLantasticCheckRoot, BOOL& lastIsLantasticPath);
157161

158162
// returns TRUE for network paths
@@ -259,8 +263,12 @@ BOOL PathsAreOnTheSameVolume(const char* path1, const char* path2, BOOL* resIsOn
259263
BOOL IsTheSamePath(const char* path1, const char* path2);
260264

261265
// determines if path is plugin FS type, 'path' is the path being checked, 'fsName' is
262-
// buffer of MAX_PATH characters for FS name (or NULL), returns 'userPart' (if != NULL) - pointer
263-
// into 'path' to first character of plugin-defined path (after first ':')
266+
// optional output buffer for FS name (size in 'fsNameBufSize', can be NULL),
267+
// returns 'userPart' (if != NULL) - pointer into 'path' to first character
268+
// of plugin-defined path (after first ':')
269+
BOOL IsPluginFSPath(const char* path, char* fsName, int fsNameBufSize, const char** userPart = NULL);
270+
BOOL IsPluginFSPath(char* path, char* fsName, int fsNameBufSize, char** userPart = NULL);
271+
// legacy compatibility overloads ('fsName' must be at least MAX_PATH if non-NULL)
264272
BOOL IsPluginFSPath(const char* path, char* fsName = NULL, const char** userPart = NULL);
265273
BOOL IsPluginFSPath(char* path, char* fsName = NULL, char** userPart = NULL);
266274

@@ -272,8 +280,9 @@ BOOL IsFileURLPath(const char* path);
272280
int IsFileLink(const char* fileExtension);
273281

274282
// gets both UNC and normal root path from 'path', returns path in 'root' in format 'C:\' or '\\SERVER\SHARE\',
275-
// returns number of characters in root path (without null-terminator); 'root' is buffer of at least MAX_PATH characters, for longer
276-
// UNC root paths truncates to MAX_PATH-2 characters and adds backslash (either way it's not 100% a root path)
283+
// returns number of characters in root path (without null-terminator)
284+
int GetRootPath(char* root, int rootBufSize, const char* path);
285+
// legacy compatibility overload ('root' must be at least MAX_PATH)
277286
int GetRootPath(char* root, const char* path);
278287

279288
// returns pointer after root (more precisely to backslash right after root) of both UNC and normal path 'path'
@@ -883,8 +892,11 @@ BOOL ResolveSubsts(char* resPath);
883892

884893
// Performs resolve of subst and reparse point for path 'path', then attempts to get GUID path
885894
// for the mount-point of the path (if missing, for the root of the path). Returns FALSE on failure.
886-
// On success, returns TRUE and sets 'mountPoint' and 'guidPath' (if different from NULL, must
887-
// point to buffers of size at least MAX_PATH; strings will be terminated with backslash).
895+
// On success, returns TRUE and sets 'mountPoint' and 'guidPath' (if non-NULL; sizes are in
896+
// 'mountPointBufSize' and 'guidPathBufSize'; strings are terminated with backslash).
897+
BOOL GetResolvedPathMountPointAndGUID(const char* path, char* mountPoint, int mountPointBufSize,
898+
char* guidPath, int guidPathBufSize);
899+
// legacy compatibility overloads ('mountPoint'/'guidPath' must be at least MAX_PATH if non-NULL)
888900
BOOL GetResolvedPathMountPointAndGUID(const char* path, char* mountPoint, char* guidPath);
889901

890902
// attempt to return correct values (also handles reparse points - complete path is specified instead of root)
@@ -921,6 +933,8 @@ BOOL GetReparsePointDestination(const char* repPointDir, char* repPointDstBuf, D
921933
// in 'currentReparsePoint' (at least MAX_PATH characters) returns current (last) local
922934
// reparse point, on failure returns classic root; returns FALSE on failure; if
923935
// 'error' is not NULL, TRUE is written to it on error
936+
BOOL GetCurrentLocalReparsePoint(const char* path, char* currentReparsePoint, int currentReparsePointBufSize, BOOL* error = NULL);
937+
// legacy compatibility overload ('currentReparsePoint' must be at least MAX_PATH)
924938
BOOL GetCurrentLocalReparsePoint(const char* path, char* currentReparsePoint, BOOL* error = NULL);
925939

926940
// call only for paths 'path' whose root (after removing subst) is DRIVE_FIXED (elsewhere it makes no sense to search for
@@ -2369,8 +2383,10 @@ void ShellActionAux6(CFilesWindow* panel);
23692383

23702384
//******************************************************************************
23712385

2372-
// returns in 'path' (buffer at least MAX_PATH characters) the path Configuration.IfPathIsInaccessibleGoTo;
2386+
// returns in 'path' the path Configuration.IfPathIsInaccessibleGoTo;
23732387
// takes into account Configuration.IfPathIsInaccessibleGoToIsMyDocs setting
2388+
void GetIfPathIsInaccessibleGoTo(char* path, int pathBufSize, BOOL forceIsMyDocs);
2389+
// legacy compatibility overload ('path' must be at least 2 * MAX_PATH)
23742390
void GetIfPathIsInaccessibleGoTo(char* path, BOOL forceIsMyDocs = FALSE);
23752391

23762392
// loads icon overlay handler configuration from registry configuration
@@ -2399,19 +2415,25 @@ BOOL RestoreNetworkConnection(HWND parent, const char* name, const char* remoteN
23992415
LPNETRESOURCE lpNetResource = NULL);
24002416

24012417
// constructs text for Type column in panel for unassociated file (e.g. "AAA File" or "File")
2418+
void GetCommonFileTypeStr(char* buf, int bufSize, int* resLen, const char* ext);
2419+
// legacy compatibility overload ('buf' must be at least TRANSFER_BUFFER_MAX)
24022420
void GetCommonFileTypeStr(char* buf, int* resLen, const char* ext);
24032421

24042422
// finds doubled separators and removes unnecessary ones (on Vista I encountered doubled
24052423
// separators in context menu on .bar files)
24062424
void RemoveUselessSeparatorsFromMenu(HMENU h);
24072425

2408-
// returns "Open Salamander" directory on path CSIDL_APPDATA in 'buf' (buffer of size MAX_PATH)
2426+
// returns "Open Salamander" directory on path CSIDL_APPDATA in 'buf'
2427+
BOOL GetOurPathInRoamingAPPDATA(char* buf, int bufSize);
2428+
// legacy compatibility overload ('buf' must be at least MAX_PATH)
24092429
BOOL GetOurPathInRoamingAPPDATA(char* buf);
24102430

24112431
// creates "Open Salamander" directory on path CSIDL_APPDATA; returns TRUE if path
24122432
// fits in MAX_PATH (its existence is not guaranteed, CreateDirectory result is not checked);
2413-
// if 'buf' is not NULL, it is buffer of size MAX_PATH, in which this path is returned
2433+
// if 'buf' is not NULL, it is output buffer of size 'bufSize', in which this path is returned
24142434
// WARNING: use only Vista+
2435+
BOOL CreateOurPathInRoamingAPPDATA(char* buf, int bufSize);
2436+
// legacy compatibility overload ('buf' must be at least MAX_PATH if non-NULL)
24152437
BOOL CreateOurPathInRoamingAPPDATA(char* buf);
24162438

24172439
#ifndef _WIN64

src/dialogs3.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ void CDriveInfo::Transfer(CTransferInfo& ti)
13701370
char guidPath[MAX_PATH];
13711371
mountPoint[0] = 0;
13721372
guidPath[0] = 0;
1373-
if (GetResolvedPathMountPointAndGUID(VolumePath, mountPoint, guidPath))
1373+
if (GetResolvedPathMountPointAndGUID(VolumePath, mountPoint, _countof(mountPoint), guidPath, _countof(guidPath)))
13741374
{
13751375
SetDlgItemTextUtf8(HWindow, IDT_MOUNTPOINT, mountPoint);
13761376
SetDlgItemTextUtf8(HWindow, IDT_GUIDPATH, guidPath);

src/dialogs5.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,7 @@ void CCfgPageDrives::Transfer(CTransferInfo& ti)
18271827
char newPath[MAX_PATH];
18281828
if (ti.Type == ttDataToWindow)
18291829
{
1830-
GetIfPathIsInaccessibleGoTo(path);
1830+
GetIfPathIsInaccessibleGoTo(path, _countof(path), FALSE);
18311831
ti.EditLine(IDE_DRVSPEC_ONERRGOTO, path, MAX_PATH);
18321832
IfPathIsInaccessibleGoToChanged = FALSE;
18331833
}
@@ -1836,7 +1836,7 @@ void CCfgPageDrives::Transfer(CTransferInfo& ti)
18361836
if (IfPathIsInaccessibleGoToChanged) // change only if the user actually edited the path
18371837
{
18381838
ti.EditLine(IDE_DRVSPEC_ONERRGOTO, newPath, MAX_PATH);
1839-
GetIfPathIsInaccessibleGoTo(path, TRUE);
1839+
GetIfPathIsInaccessibleGoTo(path, _countof(path), TRUE);
18401840
if (IsTheSamePath(path, newPath)) // user wants to go to My Documents
18411841
{
18421842
Configuration.IfPathIsInaccessibleGoToIsMyDocs = TRUE;

src/dialogs6.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ CDriveSelectErrDlg::DialogProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
24342434

24352435
case DRIVE_FIXED: // mount-point, determine the root of removable drive
24362436
{
2437-
if (!GetCurrentLocalReparsePoint(DrvPath, root))
2437+
if (!GetCurrentLocalReparsePoint(DrvPath, root, _countof(root)))
24382438
setTimer = FALSE; // can't be a mount-point, no periodic tests
24392439
break;
24402440
}

src/fileswn2.cpp

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ BOOL CFilesWindow::ChangeToRescuePathOrFixedDrive(HWND parent, BOOL* noChange, B
647647
refreshListBox, canForce, tryCloseReason);
648648
BOOL noChangeUsed = FALSE;
649649
char ifPathIsInaccessibleGoTo[MAX_PATH];
650-
GetIfPathIsInaccessibleGoTo(ifPathIsInaccessibleGoTo);
650+
GetIfPathIsInaccessibleGoTo(ifPathIsInaccessibleGoTo, _countof(ifPathIsInaccessibleGoTo), FALSE);
651651
if (ifPathIsInaccessibleGoTo[0] == '\\' && ifPathIsInaccessibleGoTo[1] == '\\' ||
652652
ifPathIsInaccessibleGoTo[0] != 0 && ifPathIsInaccessibleGoTo[1] == ':')
653653
{
@@ -1704,7 +1704,7 @@ BOOL CFilesWindow::ChangePathToDisk(HWND parent, const char* path, int suggested
17041704
BOOL canTryUserRescuePath = FALSE; // allows using Configuration.IfPathIsInaccessibleGoTo right before the fixed-drive path
17051705
BOOL openIfPathIsInaccessibleGoToCfg = FALSE;
17061706
char ifPathIsInaccessibleGoTo[2 * MAX_PATH];
1707-
GetIfPathIsInaccessibleGoTo(ifPathIsInaccessibleGoTo);
1707+
GetIfPathIsInaccessibleGoTo(ifPathIsInaccessibleGoTo, _countof(ifPathIsInaccessibleGoTo), FALSE);
17081708
if ((ifPathIsInaccessibleGoTo[0] == '\\' && ifPathIsInaccessibleGoTo[1] == '\\' ||
17091709
ifPathIsInaccessibleGoTo[0] != 0 && ifPathIsInaccessibleGoTo[1] == ':') &&
17101710
!IsTheSamePath(path, ifPathIsInaccessibleGoTo))
@@ -1822,7 +1822,7 @@ BOOL CFilesWindow::ChangePathToDisk(HWND parent, const char* path, int suggested
18221822
canTryUserRescuePath = FALSE; // we won't try it more than once
18231823
openIfPathIsInaccessibleGoToCfg = TRUE;
18241824
fixedDrive = FALSE; // we'll allow switching to a fixed-drive (perhaps it was tried already but the user path had priority)
1825-
GetIfPathIsInaccessibleGoTo(changedPath);
1825+
GetIfPathIsInaccessibleGoTo(changedPath, _countof(changedPath), FALSE);
18261826
shorterPathWarning = TRUE; // we want to see errors for the "rescue" path
18271827
change = TRUE;
18281828
}
@@ -1934,7 +1934,7 @@ BOOL CFilesWindow::ChangePathToDisk(HWND parent, const char* path, int suggested
19341934
}
19351935
if (drvType != DRIVE_REMOTE)
19361936
{
1937-
GetCurrentLocalReparsePoint(changedPath, CheckPathRootWithRetryMsgBox);
1937+
GetCurrentLocalReparsePoint(changedPath, CheckPathRootWithRetryMsgBox, MAX_PATH);
19381938
if (strlen(CheckPathRootWithRetryMsgBox) > 3)
19391939
{
19401940
lstrcpyn(drive, CheckPathRootWithRetryMsgBox, MAX_PATH);
@@ -3483,8 +3483,18 @@ void CFilesWindow::GetContextMenuPos(POINT* p)
34833483
ClientToScreen(GetListBoxHWND(), p);
34843484
}
34853485

3486-
void GetCommonFileTypeStr(char* buf, int* resLen, const char* ext)
3486+
void GetCommonFileTypeStr(char* buf, int bufSize, int* resLen, const char* ext)
34873487
{
3488+
if (buf == NULL || resLen == NULL || ext == NULL || bufSize <= 0)
3489+
{
3490+
TRACE_E("GetCommonFileTypeStr(): invalid parameter.");
3491+
if (buf != NULL && bufSize > 0)
3492+
buf[0] = 0;
3493+
if (resLen != NULL)
3494+
*resLen = 0;
3495+
return;
3496+
}
3497+
34883498
char uppercaseExt[MAX_PATH];
34893499
char* d = uppercaseExt;
34903500
char* end = uppercaseExt + MAX_PATH - 1;
@@ -3493,17 +3503,22 @@ void GetCommonFileTypeStr(char* buf, int* resLen, const char* ext)
34933503
*d = 0;
34943504
if (*ext == 0 && uppercaseExt[0] != 0)
34953505
{ // we have the entire extension in uppercase (no spaces and shorter than MAX_PATH) + it is not empty
3496-
*resLen = _snprintf_s(buf, TRANSFER_BUFFER_MAX, _TRUNCATE, CommonFileTypeName2, uppercaseExt);
3506+
*resLen = _snprintf_s(buf, bufSize, _TRUNCATE, CommonFileTypeName2, uppercaseExt);
34973507
if (*resLen < 0)
3498-
*resLen = TRANSFER_BUFFER_MAX - 1; // _snprintf_s reports truncation to the buffer size
3508+
*resLen = bufSize - 1; // _snprintf_s reports truncation to the buffer size
34993509
}
35003510
else
35013511
{
3502-
memcpy(buf, CommonFileTypeName, CommonFileTypeNameLen + 1);
3503-
*resLen = CommonFileTypeNameLen;
3512+
lstrcpyn(buf, CommonFileTypeName, bufSize);
3513+
*resLen = (int)strlen(buf);
35043514
}
35053515
}
35063516

3517+
void GetCommonFileTypeStr(char* buf, int* resLen, const char* ext)
3518+
{
3519+
GetCommonFileTypeStr(buf, TRANSFER_BUFFER_MAX, resLen, ext);
3520+
}
3521+
35073522
void CFilesWindow::RefreshListBox(int suggestedXOffset,
35083523
int suggestedTopIndex, int suggestedFocusIndex,
35093524
BOOL ensureFocusIndexVisible, BOOL wholeItemVisible)
@@ -3859,7 +3874,7 @@ void CFilesWindow::RefreshListBox(int suggestedXOffset,
38593874
if (commonFileType)
38603875
{
38613876
int resLen;
3862-
GetCommonFileTypeStr(buf, &resLen, f->Ext);
3877+
GetCommonFileTypeStr(buf, _countof(buf), &resLen, f->Ext);
38633878
GetTextExtentPoint32(dc, buf, resLen, &act);
38643879
act.cx += SPACE_WIDTH;
38653880
if (columnWidthType < act.cx)

src/fileswn3.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ BOOL CFilesWindow::ReadDirectory(HWND parent, BOOL isRefresh)
450450
}
451451
if (drvType2 != DRIVE_REMOTE)
452452
{
453-
GetCurrentLocalReparsePoint(GetPath(), CheckPathRootWithRetryMsgBox);
453+
GetCurrentLocalReparsePoint(GetPath(), CheckPathRootWithRetryMsgBox, MAX_PATH);
454454
if (strlen(CheckPathRootWithRetryMsgBox) > 3)
455455
{
456456
lstrcpyn(drive, CheckPathRootWithRetryMsgBox, MAX_PATH);
@@ -2088,7 +2088,7 @@ BOOL CFilesWindow::ChangeDir(const char* newDir, int suggestedTopIndex, const ch
20882088

20892089
char fsName[2 * MAX_PATH];
20902090
char* fsUserPart;
2091-
if (!sendDirectlyToPluginLocal && IsPluginFSPath(path, fsName, (const char**)&fsUserPart))
2091+
if (!sendDirectlyToPluginLocal && IsPluginFSPath(path, fsName, _countof(fsName), (const char**)&fsUserPart))
20922092
{
20932093
if (strlen(fsUserPart) >= 2 * MAX_PATH) // plugins do not count with longer path
20942094
{
@@ -2553,7 +2553,7 @@ BOOL CFilesWindow::ChangeDir(const char* newDir, int suggestedTopIndex, const ch
25532553
}
25542554
if (drvType != DRIVE_REMOTE)
25552555
{
2556-
GetCurrentLocalReparsePoint(copy, CheckPathRootWithRetryMsgBox);
2556+
GetCurrentLocalReparsePoint(copy, CheckPathRootWithRetryMsgBox, MAX_PATH);
25572557
if (strlen(CheckPathRootWithRetryMsgBox) > 3)
25582558
{
25592559
lstrcpyn(drive, CheckPathRootWithRetryMsgBox, MAX_PATH);

src/fileswn8.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void PluginFSConvertPathToExternal(char* path)
135135
char* fsUserPart;
136136
int index;
137137
int fsNameIndex;
138-
if (IsPluginFSPath(path, fsName, (const char**)&fsUserPart) &&
138+
if (IsPluginFSPath(path, fsName, _countof(fsName), (const char**)&fsUserPart) &&
139139
Plugins.IsPluginFS(fsName, index, fsNameIndex))
140140
{
141141
CPluginData* plugin = Plugins.Get(index);

0 commit comments

Comments
 (0)