summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 22:29:53 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 22:29:53 (GMT)
commit015f4d87ab0f7d0888a9f20672feaec373f8ef36 (patch)
tree4b3444f0d329c5b4283a6f9b77e77026552d093c /Python
parenta4a759515e2e0114d41acdada3642265c01270ac (diff)
downloadcpython-015f4d87ab0f7d0888a9f20672feaec373f8ef36.zip
cpython-015f4d87ab0f7d0888a9f20672feaec373f8ef36.tar.gz
cpython-015f4d87ab0f7d0888a9f20672feaec373f8ef36.tar.bz2
_Py_wrealpath() requires the size of the output buffer
Diffstat (limited to 'Python')
-rw-r--r--Python/fileutils.c5
-rw-r--r--Python/sysmodule.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index bd6ab5d..502868f 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;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 1eba28e..d02ee5b 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1742,7 +1742,7 @@ sys_update_path(int argc, wchar_t **argv)
#else /* All other filename syntaxes */
if (_HAVE_SCRIPT_ARGUMENT(argc, argv)) {
#if defined(HAVE_REALPATH)
- if (_Py_wrealpath(argv0, fullpath)) {
+ if (_Py_wrealpath(argv0, fullpath, PATH_MAX)) {
argv0 = fullpath;
}
#endif