[Python-checkins] r56353 - python/branches/release25-maint/Modules/_ctypes/callbacks.c python/branches/release25-maint/Modules/_ctypes/ctypes.h

thomas.heller python-checkins at python.org
Fri Jul 13 19:33:13 CEST 2007


Author: thomas.heller
Date: Fri Jul 13 19:33:13 2007
New Revision: 56353

Modified:
   python/branches/release25-maint/Modules/_ctypes/callbacks.c
   python/branches/release25-maint/Modules/_ctypes/ctypes.h
Log:
Fix for SF# 1649098: avoid zero-sized array declaration in structure.



Modified: python/branches/release25-maint/Modules/_ctypes/callbacks.c
==============================================================================
--- python/branches/release25-maint/Modules/_ctypes/callbacks.c	(original)
+++ python/branches/release25-maint/Modules/_ctypes/callbacks.c	Fri Jul 13 19:33:13 2007
@@ -268,7 +268,7 @@
 	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;

Modified: python/branches/release25-maint/Modules/_ctypes/ctypes.h
==============================================================================
--- python/branches/release25-maint/Modules/_ctypes/ctypes.h	(original)
+++ python/branches/release25-maint/Modules/_ctypes/ctypes.h	Fri Jul 13 19:33:13 2007
@@ -74,7 +74,7 @@
 	PyObject *callable;
 	SETFUNC setfunc;
 	ffi_type *restype;
-	ffi_type *atypes[0];
+	ffi_type *atypes[1];
 } ffi_info;
 
 typedef struct {


More information about the Python-checkins mailing list