mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	_Py_stat(): ensure that path ends with a nul character
This commit is contained in:
		
							parent
							
								
									09245d8682
								
							
						
					
					
						commit
						8a79dccc48
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -1976,10 +1976,11 @@ _Py_stat(PyObject *unicode, struct stat *statbuf) | ||||||
|     int err; |     int err; | ||||||
|     struct _stat wstatbuf; |     struct _stat wstatbuf; | ||||||
| 
 | 
 | ||||||
|     len = PyUnicode_AsWideChar((PyUnicodeObject*)unicode, path, |     len = PyUnicode_AsWideChar((PyUnicodeObject*)unicode, path, MAXPATHLEN); | ||||||
|                                sizeof(path) / sizeof(path[0])); |  | ||||||
|     if (len == -1) |     if (len == -1) | ||||||
|         return -1; |         return -1; | ||||||
|  |     path[len] = L'\0'; | ||||||
|  | 
 | ||||||
|     err = _wstat(path, &wstatbuf); |     err = _wstat(path, &wstatbuf); | ||||||
|     if (!err) |     if (!err) | ||||||
|         statbuf->st_mode = wstatbuf.st_mode; |         statbuf->st_mode = wstatbuf.st_mode; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner