[Python-checkins] python/nondist/sandbox/csv _csv.c,1.31,1.32
montanaro@users.sourceforge.net
montanaro@users.sourceforge.net
Fri, 14 Feb 2003 16:53:02 -0800
Update of /cvsroot/python/python/nondist/sandbox/csv
In directory sc8-pr-cvs1:/tmp/cvs-serv30739
Modified Files:
_csv.c
Log Message:
test for NUL bytes in strings
Index: _csv.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/csv/_csv.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** _csv.c 14 Feb 2003 06:32:40 -0000 1.31
--- _csv.c 15 Feb 2003 00:52:59 -0000 1.32
***************
*** 643,650 ****
--- 643,657 ----
}
line = PyString_AsString(lineobj);
+
if (line == NULL) {
Py_DECREF(lineobj);
return NULL;
}
+ if (strlen(line) < PyString_GET_SIZE(lineobj)) {
+ self->had_parse_error = 1;
+ Py_DECREF(lineobj);
+ return PyErr_Format(error_obj,
+ "string with NUL bytes");
+ }
/* Process line of text - send '\0' to processing code to