innd/python.c empty article patch
greg andruk
supersede at india.com
Sun Dec 10 05:21:37 UTC 2000
If an article has headers, a blank line, then no body, innd will
accept it but the Python filter (if enabled) will then try to use a
buffer of length -1. This can cause a segfault.
A fix:
--- innd/python.c.orig Sat Dec 9 23:42:03 2000
+++ innd/python.c Sun Dec 10 00:04:34 2000
@@ -135,10 +135,11 @@
}
/* ...then the body... */
- if (artBody != NULL) {
- PYheaditem[hdrnum] = PyBuffer_FromMemory(artBody, --artLen);
- PyDict_SetItem(PYheaders, PYbodykey, PYheaditem[hdrnum++]);
- }
+ if (artLen && artBody != NULL)
+ PYheaditem[hdrnum] = PyBuffer_FromMemory(artBody, --artLen);
+ else
+ PYheaditem[hdrnum] = Py_None;
+ PyDict_SetItem(PYheaders, PYbodykey, PYheaditem[hdrnum++]);
/* ...and finally, the line count. */
PYheaditem[hdrnum] = PyInt_FromLong((long) lines);
More information about the inn-patches
mailing list