From: Jeremy Harris Date: Thu, 5 May 2022 15:22:54 +0000 (+0100) Subject: Fix dbmjz lookup. Bug 2884 X-Git-Tag: exim-4.96-RC1~9 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/225c84f0f35d3aea1f0845eedde7632c371e1f99 Fix dbmjz lookup. Bug 2884 Broken-by: 0cc804c877 --- diff --git a/src/src/lookups/dbmdb.c b/src/src/lookups/dbmdb.c index edc49e581..32514afcc 100644 --- a/src/src/lookups/dbmdb.c +++ b/src/src/lookups/dbmdb.c @@ -94,8 +94,10 @@ EXIM_DATUM key, data; exim_datum_init(&key); /* Some DBM libraries require datums to */ exim_datum_init(&data); /* be cleared before use. */ -exim_datum_data_set(&key, string_copyn(keystring, length)); -exim_datum_size_set(&key, length + 1); +length++; +exim_datum_data_set(&key, + memcpy(store_get(length, keystring), keystring, length)); /* key can have embedded NUL */ +exim_datum_size_set(&key, length); if (exim_dbget(d, &key, &data)) { diff --git a/test/aux-fixed/2301.testsasldb b/test/aux-fixed/2301.testsasldb new file mode 100644 index 000000000..50a05965d Binary files /dev/null and b/test/aux-fixed/2301.testsasldb differ diff --git a/test/confs/2301 b/test/confs/2301 new file mode 100644 index 000000000..3e88df718 --- /dev/null +++ b/test/confs/2301 @@ -0,0 +1,4 @@ +# Exim test configuration 2301 +.include DIR/aux-var/std_conf_prefix +primary_hostname = myhost.test.ex +# End diff --git a/test/scripts/2300-DBM/2301 b/test/scripts/2300-DBM/2301 new file mode 100644 index 000000000..9ba0c5079 --- /dev/null +++ b/test/scripts/2300-DBM/2301 @@ -0,0 +1,5 @@ +# lookup dbmjz +# +exim -be +${lookup{testid:test.example.invalid:userPassword}dbmjz{DIR/aux-fixed/TESTNUM.testsasldb}{$value}fail} +**** diff --git a/test/stdout/2301 b/test/stdout/2301 new file mode 100644 index 000000000..ca59bf00b --- /dev/null +++ b/test/stdout/2301 @@ -0,0 +1,2 @@ +> testpw +>