From: Jim Jagielski Date: Wed, 10 Sep 2003 14:21:12 +0000 (+0000) Subject: These silent errors have bitten me a few times, now that we X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=439b77c801dc0e5f9e5bac676abf19a6b780d5d4;p=thirdparty%2Fapache%2Fhttpd.git These silent errors have bitten me a few times, now that we use APR'd dbm. mod_ssl had hacked sdbm for larger sizes. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/ssl@101214 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/ssl_scache_dbm.c b/ssl_scache_dbm.c index abcfa8d1c2e..6ec20037c20 100644 --- a/ssl_scache_dbm.c +++ b/ssl_scache_dbm.c @@ -145,18 +145,30 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS apr_status_t rv; /* streamline session data */ - if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData)) + if ((nData = i2d_SSL_SESSION(sess, NULL)) > sizeof(ucaData)) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "streamline session data size too large: %d > %d", + nData, sizeof(ucaData)); return FALSE; + } ucp = ucaData; i2d_SSL_SESSION(sess, &ucp); /* be careful: do not try to store too much bytes in a DBM file! */ #ifdef PAIRMAX - if ((idlen + nData) >= PAIRMAX) + if ((idlen + nData) >= PAIRMAX) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "data size too large for DBM session cache: %d >= %d", + (idlen + nData), PAIRMAX); return FALSE; + } #else - if ((idlen + nData) >= 950 /* at least less than approx. 1KB */) + if ((idlen + nData) >= 950 /* at least less than approx. 1KB */) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "data size too large for DBM session cache: %d >= %d", + (idlen + nData), 950); return FALSE; + } #endif /* create DBM key */ @@ -166,8 +178,11 @@ BOOL ssl_scache_dbm_store(server_rec *s, UCHAR *id, int idlen, time_t expiry, SS /* create DBM value */ dbmval.dsize = sizeof(time_t) + nData; dbmval.dptr = (char *)malloc(dbmval.dsize); - if (dbmval.dptr == NULL) + if (dbmval.dptr == NULL) { + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "malloc error creating DBM value"); return FALSE; + } memcpy((char *)dbmval.dptr, &expiry, sizeof(time_t)); memcpy((char *)dbmval.dptr+sizeof(time_t), ucaData, nData);