SPDX: license tags (mostly by guesswork)
[exim.git] / src / src / lookups / dbmdb.c
index edc49e581dd61a9ba7676a25a9838fd4ab0f4b3f..c99e948b59a532294e87a564ffe3874f3682e0bc 100644 (file)
@@ -5,6 +5,7 @@
 /* Copyright (c) The Exim Maintainers 2020 - 2022 */
 /* Copyright (c) University of Cambridge 1995 - 2018 */
 /* 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))
   {