SPDX: license tags (mostly by guesswork)
[exim.git] / src / src / lookups / dbmdb.c
index 95f31bc160a4a2a02097b6530b90b211901a1c38..c99e948b59a532294e87a564ffe3874f3682e0bc 100644 (file)
@@ -2,9 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
+/* Copyright (c) The Exim Maintainers 2020 - 2022 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
-/* Copyright (c) The Exim Maintainers 2020 - 2021 */
 /* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #include "../exim.h"
 #include "lf_functions.h"
@@ -94,8 +95,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))
   {