[Python-checkins] python/dist/src/Modules posixmodule.c, 2.319, 2.320

nnorwitz at users.sourceforge.net nnorwitz at users.sourceforge.net
Tue Jun 8 21:46:05 EDT 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22503/Modules

Modified Files:
	posixmodule.c 
Log Message:
Ensure path is initialized to prevent freeing random memory
(reported by Thomas Heller).  If have_unicode_filename is set,
path looks like it will not be used, so there's no need to free it.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.319
retrieving revision 2.320
diff -C2 -d -r2.319 -r2.320
*** posixmodule.c	6 Jun 2004 20:40:27 -0000	2.319
--- posixmodule.c	9 Jun 2004 01:46:02 -0000	2.320
***************
*** 1995,1999 ****
  posix_utime(PyObject *self, PyObject *args)
  {
! 	char *path;
  	long atime, mtime, ausec, musec;
  	int res;
--- 1995,1999 ----
  posix_utime(PyObject *self, PyObject *args)
  {
! 	char *path = NULL;
  	long atime, mtime, ausec, musec;
  	int res;
***************
*** 2088,2095 ****
  	if (res < 0) {
  #ifdef Py_WIN_WIDE_FILENAMES
! 		if (have_unicode_filename) {
! 			PyMem_Free(path);
  			return posix_error_with_unicode_filename(wpath);
- 		}
  #endif /* Py_WIN_WIDE_FILENAMES */
  		return posix_error_with_allocated_filename(path);
--- 2088,2093 ----
  	if (res < 0) {
  #ifdef Py_WIN_WIDE_FILENAMES
! 		if (have_unicode_filename)
  			return posix_error_with_unicode_filename(wpath);
  #endif /* Py_WIN_WIDE_FILENAMES */
  		return posix_error_with_allocated_filename(path);




More information about the Python-checkins mailing list