summaryrefslogtreecommitdiff
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 22:29:53 +0000
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 22:29:53 +0000
commitf99397e5074b70e10303516e11f73083e1b9dd5d (patch)
tree1d82eaa2df1389adf986bdbf8e9a5a26ff11cdf0 /Python/fileutils.c
parent857734b7d26fb28bf7268a1a733155836feaab55 (diff)
downloadcpython-f99397e5074b70e10303516e11f73083e1b9dd5d.tar.gz
_Py_wrealpath() requires the size of the output buffer
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c5
1 files changed, 3 insertions, 2 deletions
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;