File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,15 +179,18 @@ _wgetcwd(wchar_t *buf, size_t size)
179179int
180180_Py_wreadlink (const wchar_t * path , wchar_t * buf , size_t bufsiz )
181181{
182+ char * cpath ;
182183 char cbuf [PATH_MAX ];
183- char cpath [PATH_MAX ];
184184 int res ;
185- size_t r1 = wcstombs (cpath , path , PATH_MAX );
186- if (r1 == (size_t )-1 || r1 >= PATH_MAX ) {
185+ size_t r1 ;
186+
187+ cpath = _Py_wchar2char (path );
188+ if (cpath == NULL ) {
187189 errno = EINVAL ;
188190 return -1 ;
189191 }
190192 res = (int )readlink (cpath , cbuf , PATH_MAX );
193+ PyMem_Free (cpath );
191194 if (res == -1 )
192195 return -1 ;
193196 if (res == PATH_MAX ) {
Original file line number Diff line number Diff line change @@ -1661,16 +1661,17 @@ makeargvobject(int argc, wchar_t **argv)
16611661static wchar_t *
16621662_wrealpath (const wchar_t * path , wchar_t * resolved_path )
16631663{
1664- char cpath [ PATH_MAX ] ;
1664+ char * cpath ;
16651665 char cresolved_path [PATH_MAX ];
16661666 char * res ;
16671667 size_t r ;
1668- r = wcstombs ( cpath , path , PATH_MAX );
1669- if (r == ( size_t ) -1 || r >= PATH_MAX ) {
1668+ cpath = _Py_wchar2char ( path );
1669+ if (cpath == NULL ) {
16701670 errno = EINVAL ;
16711671 return NULL ;
16721672 }
16731673 res = realpath (cpath , cresolved_path );
1674+ PyMem_Free (cpath );
16741675 if (res == NULL )
16751676 return NULL ;
16761677 r = mbstowcs (resolved_path , cresolved_path , PATH_MAX );
You can’t perform that action at this time.
0 commit comments