mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
_Py_wrealpath() requires the size of the output buffer
This commit is contained in:
parent
a4a759515e
commit
015f4d87ab
3 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue