SPDX: license tags (mostly by guesswork)
[exim.git] / src / src / string.c
index 4d870ec9ac1a96f37776e5ba9e197122483a9c9a..ff4180b2bbd4823ed573d333c9587cbe00a838ab 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 */
 
 /* Miscellaneous string-handling functions. Some are not required for
 utilities and tests, and are cut out by the COMPILE_UTILITY macro. */
@@ -1166,6 +1167,13 @@ if (!g)
   unsigned size = ((count + inc) &  ~inc) + 1; /* round up requested count */
   g = string_get_tainted(size, s);
   }
+else if (!g->s)                        /* should not happen */
+  {
+  g->s = string_copyn(s, count);
+  g->ptr = count;
+  g->size = count;     /*XXX suboptimal*/
+  return g;
+  }
 else if (is_incompatible(g->s, s))
   {
 /* debug_printf("rebuf A\n"); */