[Python-checkins] python/dist/src/Modules nismodule.c,2.23,2.24
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Mon, 04 Nov 2002 15:21:12 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv11311/Modules
Modified Files:
nismodule.c
Log Message:
SF #633013, Fix NIS causing interpreter core dump
Prevent the lengths passed to PyString_FromStringAndSize()
from being negative in some cases.
Index: nismodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/nismodule.c,v
retrieving revision 2.23
retrieving revision 2.24
diff -C2 -d -r2.23 -r2.24
*** nismodule.c 31 Mar 2002 15:27:00 -0000 2.23
--- nismodule.c 4 Nov 2002 23:21:09 -0000 2.24
***************
*** 86,91 ****
if (indata->fix) {
! inkeylen--;
! invallen--;
}
key = PyString_FromStringAndSize(inkey, inkeylen);
--- 86,93 ----
if (indata->fix) {
! if (inkeylen > 0 && inkey[inkeylen-1] == '\0')
! inkeylen--;
! if (invallen > 0 && inval[invallen-1] == '\0')
! invallen--;
}
key = PyString_FromStringAndSize(inkey, inkeylen);