summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2012-08-28 22:19:08 -0700
committerVicent Marti <tanoku@gmail.com>2012-08-28 23:26:00 -0700
commit0f4c61754bd123b3bee997b397187c9b813ca3e4 (patch)
tree4278875a298e527b27a4517f5a054b7e2cf87cee /src/path.c
parent6813169ac9fe2558e4503f0149f22c5fad9d61c1 (diff)
downloadlibgit2-0f4c61754bd123b3bee997b397187c9b813ca3e4.tar.gz
Add bounds checking to UTF-8 conversionutf8-win
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/path.c b/src/path.c
index 15188850d..09556bd3f 100644
--- a/src/path.c
+++ b/src/path.c
@@ -432,14 +432,14 @@ bool git_path_is_empty_dir(const char *path)
{
git_buf pathbuf = GIT_BUF_INIT;
HANDLE hFind = INVALID_HANDLE_VALUE;
- wchar_t *wbuf;
+ wchar_t wbuf[GIT_WIN_PATH];
WIN32_FIND_DATAW ffd;
bool retval = true;
if (!git_path_isdir(path)) return false;
git_buf_printf(&pathbuf, "%s\\*", path);
- wbuf = gitwin_to_utf16(git_buf_cstr(&pathbuf));
+ git__utf8_to_16(wbuf, GIT_WIN_PATH, git_buf_cstr(&pathbuf));
hFind = FindFirstFileW(wbuf, &ffd);
if (INVALID_HANDLE_VALUE == hFind) {
@@ -455,7 +455,6 @@ bool git_path_is_empty_dir(const char *path)
FindClose(hFind);
git_buf_free(&pathbuf);
- git__free(wbuf);
return retval;
}