From: Michael S. <mi...@st...> - 2009-03-16 14:55:31
|
Zhang Huangbin wrote: > Michael Ströder wrote: >> Could somebody with more knowledge of C programming please review >> function encode_rfc2696() in Modules/ldapcontrol.c? >> >> The following var declaration could be problematic on 64-bit systems: >> >> unsigned long size; Thanks to Zhang Huangbin for giving me access to his machine for testing. So I could track it down. It seems to work with the patch below which I committed to CVS HEAD. Ciao, Michael. Index: Modules/ldapcontrol.c =================================================================== RCS file: /cvsroot/python-ldap/python-ldap/Modules/ldapcontrol.c,v retrieving revision 1.9 diff -u -r1.9 ldapcontrol.c --- Modules/ldapcontrol.c 20 Mar 2008 12:24:56 -0000 1.9 +++ Modules/ldapcontrol.c 16 Mar 2009 14:48:49 -0000 @@ -241,13 +241,15 @@ PyObject *res = 0; BerElement *ber = 0; struct berval cookie, *ctrl_val; + Py_ssize_t cookie_len; unsigned long size; ber_tag_t tag; if (!PyArg_ParseTuple(args, "is#:encode_page_control", &size, - &cookie.bv_val, &cookie.bv_len)) { + &cookie.bv_val, &cookie_len)) { goto endlbl; } + cookie.bv_len = (ber_len_t) cookie_len; if (!(ber = ber_alloc_t(LBER_USE_DER))) { LDAPerr(LDAP_NO_MEMORY); |