]> granicus.if.org Git - apache/commitdiff
Fix a bug with dbm rewrite maps which caused the wrong value to
authorJeff Trawick <trawick@apache.org>
Fri, 4 Oct 2002 16:57:38 +0000 (16:57 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 4 Oct 2002 16:57:38 +0000 (16:57 +0000)
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

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index a6a7109db25f596fb45cd6cda5f14d913957361f..e8373af3352609aa28a2665e5858b0d8d0228fd7 100644 (file)
--- 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]
 
index 131e731dbaca47260f1d8474ee73fcde7f7903a4..b4ed5d6f570d6bee74ea737c756e46cd5baf303c 100644 (file)
@@ -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  );