From df3bb510a1b2837491e3d89bae76eaa859bc458d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 5 May 2021 13:44:33 +0200 Subject: [PATCH] Windows: Ignore compiler warning C6029 in unrealdb.c as it is a false positive. src/unrealdb.c(462): error C2220: warning treated as error - no 'object' file generated src\unrealdb.c(379) : warning C6029: Possible buffer overrun in call to 'fread': use of unchecked value 'c'. [..fread of c->config->saltlen..] if (c->config->saltlen > 1024) { unrealdb_set_error(c, UNREALDB_ERROR_HEADER, "Header is corrupt (saltlen=%d)", (int)c->config->saltlen); goto unrealdb_open_fail; /* Something must be wrong, this makes no sense. */ } c->config->salt = safe_alloc(c->config->saltlen); if (fread(c->config->salt, 1, c->config->saltlen, c->fd) != c->config->saltlen) VS2019 doesn't understand that this is safe. --- src/unrealdb.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/unrealdb.c b/src/unrealdb.c index 556624802..63cd157e1 100644 --- a/src/unrealdb.c +++ b/src/unrealdb.c @@ -60,6 +60,11 @@ /** Default 'parallelism cost' for Argon2id. */ #define UNREALDB_ARGON2_DEFAULT_PARALLELISM_COST 2 +#ifdef _WIN32 +/* Ignore this warning on Windows as it is a false positive */ +#pragma warning(disable : 6029) +#endif + /* Forward declarations - only used for internal (static) functions, of course */ static SecretCache *find_secret_cache(Secret *secr, UnrealDBConfig *cfg); static void unrealdb_add_to_secret_cache(Secret *secr, UnrealDBConfig *cfg);