Fix a buffer overflow in Blender.sys.splitext. It was checking for bounds
(although it did this one char too 'friendly'), but still happily copying the string even if it was too long. Pythoneerz, please check if this is the correct fix :)
This commit is contained in:
@@ -300,8 +300,9 @@ static PyObject *M_sys_splitext( PyObject * self, PyObject * args )
|
||||
|
||||
/* loong extensions are supported -- foolish, but Python's os.path.splitext
|
||||
* supports them, so ... */
|
||||
if( n > FILE_MAXFILE || ( len - n ) > FILE_MAXFILE )
|
||||
EXPP_ReturnPyObjError( PyExc_RuntimeError, "path too long" );
|
||||
|
||||
if( n >= FILE_MAXFILE || ( len - n ) >= FILE_MAXFILE )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError, "path too long" );
|
||||
|
||||
BLI_strncpy( ext, dot, n + 1 );
|
||||
BLI_strncpy( path, name, dot - name + 1 );
|
||||
|
||||
Reference in New Issue
Block a user