From 015f4d87ab0f7d0888a9f20672feaec373f8ef36 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Oct 2010 22:29:53 +0000 Subject: _Py_wrealpath() requires the size of the output buffer --- Python/fileutils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Python/fileutils.c') diff --git a/Python/fileutils.c b/Python/fileutils.c index bd6ab5d303..502868f98c 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -321,7 +321,8 @@ _Py_wreadlink(const wchar_t *path, wchar_t *buf, size_t bufsiz) #ifdef HAVE_REALPATH wchar_t* -_Py_wrealpath(const wchar_t *path, wchar_t *resolved_path) +_Py_wrealpath(const wchar_t *path, + wchar_t *resolved_path, size_t resolved_path_size) { char *cpath; char cresolved_path[PATH_MAX]; @@ -336,7 +337,7 @@ _Py_wrealpath(const wchar_t *path, wchar_t *resolved_path) PyMem_Free(cpath); if (res == NULL) return NULL; - r = mbstowcs(resolved_path, cresolved_path, PATH_MAX); + r = mbstowcs(resolved_path, cresolved_path, resolved_path_size); if (r == (size_t)-1 || r >= PATH_MAX) { errno = EINVAL; return NULL; -- cgit v1.2.1