diff Python/fileutils.c @ 65166:8fd5d06462e6

_Py_wrealpath() requires the size of the output buffer
author Victor Stinner <victor.stinner@haypocalc.com>
date Thu, 07 Oct 2010 22:29:53 +0000
parents 2147cc152227
children 1c4774b4e98a
line wrap: on
line diff
--- a/Python/fileutils.c	Thu Oct 07 22:23:10 2010 +0000
+++ b/Python/fileutils.c	Thu Oct 07 22:29:53 2010 +0000
@@ -321,7 +321,8 @@
 
 #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 @@
     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;