[Python-checkins] python/dist/src/Modules posixmodule.c,2.270,2.271

Thomas Heller theller@python.net
07 Nov 2002 17:08:53 +0100


Forgot to say:

bugfix candidate.

> Update of /cvsroot/python/python/dist/src/Modules
> In directory usw-pr-cvs1:/tmp/cvs-serv19146
> 
> Modified Files:
> 	posixmodule.c 
> Log Message:
> Enforce valid filemode. Fixes SF Bug #623464.
> 
> 
> Index: posixmodule.c
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
> retrieving revision 2.270
> retrieving revision 2.271
> diff -C2 -d -r2.270 -r2.271
> *** posixmodule.c	2 Nov 2002 17:42:33 -0000	2.270
> --- posixmodule.c	7 Nov 2002 16:00:59 -0000	2.271
> ***************
> *** 5049,5052 ****
> --- 5049,5058 ----
>   		return NULL;
>   
> + 	if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') {
> + 		PyErr_Format(PyExc_ValueError,
> + 			     "invalid file mode '%s'", mode);
> + 		return NULL;
> + 	}
> + 
>   	Py_BEGIN_ALLOW_THREADS
>   	fp = fdopen(fd, mode);
> 
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://mail.python.org/mailman/listinfo/python-checkins