]> granicus.if.org Git - python/commitdiff
Fix for SF# 1649098: avoid zero-sized array declaration in structure.
authorThomas Heller <theller@ctypes.org>
Fri, 13 Jul 2007 17:33:13 +0000 (17:33 +0000)
committerThomas Heller <theller@ctypes.org>
Fri, 13 Jul 2007 17:33:13 +0000 (17:33 +0000)
Modules/_ctypes/callbacks.c
Modules/_ctypes/ctypes.h

index e332f00e8c7279e2b52154307fb910b2b9a291c5..65bdbb58391c68cba55c26c5323f243ee41591ea 100644 (file)
@@ -268,7 +268,7 @@ ffi_info *AllocFunctionCallback(PyObject *callable,
        ffi_abi cc;
 
        nArgs = PySequence_Size(converters);
-       p = (ffi_info *)PyMem_Malloc(sizeof(ffi_info) + sizeof(ffi_type) * (nArgs + 1));
+       p = (ffi_info *)PyMem_Malloc(sizeof(ffi_info) + sizeof(ffi_type) * (nArgs));
        if (p == NULL) {
                PyErr_NoMemory();
                return NULL;
index 0af7851020832bcbfe3c5e440b331be6535a8195..7fc2d8109b2524c9972779516cbc3cdbddb340fa 100644 (file)
@@ -74,7 +74,7 @@ typedef struct {
        PyObject *callable;
        SETFUNC setfunc;
        ffi_type *restype;
-       ffi_type *atypes[0];
+       ffi_type *atypes[1];
 } ffi_info;
 
 typedef struct {