]> 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:46:54 +0000 (17:46 +0000)
committerThomas Heller <theller@ctypes.org>
Fri, 13 Jul 2007 17:46:54 +0000 (17:46 +0000)
Misc/NEWS
Modules/_ctypes/callbacks.c
Modules/_ctypes/ctypes.h

index aa023884d85f62a37d018fee82ff721e559a127a..c4f0eeefe625e25d24cbda83e4c7575af2f9f88e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -708,6 +708,9 @@ Library
 Extension Modules
 -----------------
 
+- Bug #1649098: Avoid declaration of zero-sized array declaration in
+  structure.
+
 - Removed the rgbimg module; been deprecated since Python 2.5.
 
 - Bug #1721309: prevent bsddb module from freeing random memory.
index c57dc07be2fafdfcc73d108ca7b8a6a71c34f080..18af288ce26a0158035394cefdf699a9b5213494 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 5846e3fc594a2c0b38d69745a11f6251cf37f8f5..bf2bdaa6ffc6eddb5e846e2923fb010617855168 100644 (file)
@@ -75,7 +75,7 @@ typedef struct {
        PyObject *callable;
        SETFUNC setfunc;
        ffi_type *restype;
-       ffi_type *atypes[0];
+       ffi_type *atypes[1];
 } ffi_info;
 
 typedef struct {