From 163fbdb08e238accc0a713996725b358d68bd5a2 Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Wed, 30 Oct 2024 19:19:27 -0400 Subject: [PATCH] Freshclam: fix crash when using DatabaseCustomURL for CVD and other files Freshclam may crash if using DatabaseCustomURL for a CVD and multiple other files. The issue occurs because of a bad index in the "do not prune" list. Fixes: https://github.com/Cisco-Talos/clamav/issues/1364 --- freshclam/freshclam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freshclam/freshclam.c b/freshclam/freshclam.c index 8953024c82..729b019794 100644 --- a/freshclam/freshclam.c +++ b/freshclam/freshclam.c @@ -1504,7 +1504,7 @@ fc_error_t perform_database_update( const char *startOfFilename = strrchr(urlDatabaseList[i], '/') + 1; if (NULL != startOfFilename) { // Add the base database name to the do-not-prune list, excluding the '.cvd' extension. - doNotPruneDatabaseList[nDatabases + i] = CLI_STRNDUP(startOfFilename, strlen(startOfFilename) - strlen(".cvd")); + doNotPruneDatabaseList[nDoNotPruneDatabases] = CLI_STRNDUP(startOfFilename, strlen(startOfFilename) - strlen(".cvd")); nDoNotPruneDatabases++; } }