Author: davi Date: Fri Oct 12 16:35:28 2007 New Revision: 584323 URL: http://svn.apache.org/viewvc?rev=584323&view=rev Log: GDBM uses int type for the dsize field and APR uses size_t (unsigned long), those structures (datum, apr_datum_t) might have different sizes and alignment (especially on 64 bit platforms). PR: 43025 Submitted by: Bjorn Wiber Modified: apr/apr-util/branches/1.2.x/CHANGES apr/apr-util/branches/1.2.x/dbm/apr_dbm_gdbm.c Modified: apr/apr-util/branches/1.2.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/CHANGES?rev=584323&r1=584322&r2=584323&view=diff ============================================================================== --- apr/apr-util/branches/1.2.x/CHANGES [utf-8] (original) +++ apr/apr-util/branches/1.2.x/CHANGES [utf-8] Fri Oct 12 16:35:28 2007 @@ -1,4 +1,11 @@ -*- coding: utf-8 -*- + +Changes with APR-util 1.2.12 + + *) Type mismatch between apr_datum_t and GDBM's datum type could + yield a corrupt apr_datum_t when reading from a GDBM database. + PR 43025. [Björn Wiberg , Davi Arnaut] + Changes with APR-util 1.2.11 *) Fix exported LDFLAGS with new expat detection. PR 43337. Modified: apr/apr-util/branches/1.2.x/dbm/apr_dbm_gdbm.c URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/dbm/apr_dbm_gdbm.c?rev=584323&r1=584322&r2=584323&view=diff ============================================================================== --- apr/apr-util/branches/1.2.x/dbm/apr_dbm_gdbm.c (original) +++ apr/apr-util/branches/1.2.x/dbm/apr_dbm_gdbm.c Fri Oct 12 16:35:28 2007 @@ -41,7 +41,7 @@ #define CONVERT_DATUM(cvt, pinput) ((cvt) = (datum *)(pinput)) typedef datum result_datum_t; -#define RETURN_DATUM(poutput, rd) (*(poutput) = *(apr_datum_t *)&(rd)) +#define RETURN_DATUM(poutput, rd) ((poutput)->dptr = (rd).dptr, (poutput)->dsize = (apr_size_t) (rd).dsize) #define APR_DBM_CLOSE(f) gdbm_close(f) #define APR_DBM_FETCH(f, k, v) ((v) = gdbm_fetch(f, *(k)), APR_SUCCESS)