From 4e10ebd9de8335a65e280a806a642cd25a49c65c Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 3 Oct 2014 20:27:37 +0200 Subject: [PATCH] Optimize length check Signed-off-by: Sven Strickroth --- src/TortoiseShell/GITPropertyPage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/TortoiseShell/GITPropertyPage.cpp b/src/TortoiseShell/GITPropertyPage.cpp index 03940d8b0..a0add8431 100644 --- a/src/TortoiseShell/GITPropertyPage.cpp +++ b/src/TortoiseShell/GITPropertyPage.cpp @@ -376,14 +376,13 @@ static int TreewalkCB_FindFileRecentCommit(const char *root, const git_tree_entr static git_commit * FindFileRecentCommit(git_repository *repository, CString path) { - if (path.GetLength() >= MAX_PATH) - return nullptr; - CAutoRevwalk walk; if (git_revwalk_new(walk.GetPointer(), repository)) return nullptr; CStringA pathA = CUnicodeUtils::GetUTF8(path); + if (pathA.GetLength() >= MAX_PATH) + return nullptr; const char *pathC = pathA; char folder[MAX_PATH] = {0}, file[MAX_PATH] = {0}; const char *slash = strrchr(pathC, '/'); -- 2.11.4.GIT