From: Jeff Trawick Date: Fri, 4 Oct 2002 16:57:38 +0000 (+0000) Subject: Fix a bug with dbm rewrite maps which caused the wrong value to X-Git-Tag: 2.0.44~370 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f946ccdc87d0c9a707ee3cc8e708d1b7c69924f;p=apache Fix a bug with dbm rewrite maps which caused the wrong value to be used when the key was not found in the dbm. apr_dbm_fetch() returns APR_SUCCESS as long as there was no I/O error. mod_rewrite needed to look further to see if the key was actually found. PR 13204 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97106 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index a6a7109db2..e8373af335 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.44 + *) Fix a bug with dbm rewrite maps which caused the wrong value to + be used when the key was not found in the dbm. PR 13204 + [Jeff Trawick] + *) Fix a problem with streaming script output and mod_cgid. [Jeff Trawick] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 131e731dba..b4ed5d6f57 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2968,7 +2968,7 @@ static char *lookup_map_dbmfile(request_rec *r, const char *file, if ((rv = apr_dbm_open_ex(&dbmfp, dbmtype, file, APR_DBM_READONLY, 0 /* irrelevant when reading */, r->pool)) == APR_SUCCESS) { rv = apr_dbm_fetch(dbmfp, dbmkey, &dbmval); - if (rv == APR_SUCCESS) { + if (rv == APR_SUCCESS && dbmval.dptr) { memcpy(buf, dbmval.dptr, dbmval.dsize < sizeof(buf)-1 ? dbmval.dsize : sizeof(buf)-1 );