X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1e1ddfac79fbcd052f199500a6493c7f79cb8462..a85c067ba6c6940512cf57ec213277a370d87e70:/src/src/lookups/json.c diff --git a/src/src/lookups/json.c b/src/src/lookups/json.c index 0aaaba7f5..b1e5fb742 100644 --- a/src/src/lookups/json.c +++ b/src/src/lookups/json.c @@ -2,8 +2,10 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) Jeremy Harris 2019-2020 */ +/* Copyright (c) The Exim Maintainers 2021 - 2022 */ +/* Copyright (c) Jeremy Harris 2019 - 2020 */ /* See the file NOTICE for conditions of use and distribution. */ +/* SPDX-License-Identifier: GPL-2.0-only */ #include "../exim.h" #include "lf_functions.h" @@ -23,7 +25,7 @@ Assume that the file is trusted, so no tainting */ static void * json_malloc(size_t nbytes) { -void * p = store_get((int)nbytes, FALSE); +void * p = store_get((int)nbytes, GET_UNTAINTED); /* debug_printf("%s %d: %p\n", __FUNCTION__, (int)nbytes, p); */ return p; } @@ -47,12 +49,7 @@ FILE * f; json_set_alloc_funcs(json_malloc, json_free); if (!(f = Ufopen(filename, "rb"))) - { - int save_errno = errno; - *errmsg = string_open_failed(errno, "%s for json search", filename); - errno = save_errno; - return NULL; - } + *errmsg = string_open_failed("%s for json search", filename); return f; } @@ -89,9 +86,6 @@ json_error_t jerr; uschar * key; int sep = 0; -length = length; /* Keep picky compilers happy */ -do_cache = do_cache; /* Keep picky compilers happy */ - rewind(f); if (!(j = json_loadf(f, 0, &jerr))) { @@ -165,10 +159,10 @@ json_close(void *handle) #include "../version.h" -void -json_version_report(FILE *f) +gstring * +json_version_report(gstring * g) { -fprintf(f, "Library version: json: Jansonn version %s\n", JANSSON_VERSION); +return string_fmt_append(g, "Library version: json: Jansonn version %s\n", JANSSON_VERSION); }