aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 13:04:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-21 13:04:48 +0000
commit45df2c78a87700a7501fb889d5c2791b0d354348 (patch)
treefe2013ef89d5f80611a36c7274df30bcf510fc21
parentec8a472f21d83d3bb93a200acdd0d5b257e4e88c (diff)
downloadrspamd-45df2c78a87700a7501fb889d5c2791b0d354348.tar.gz
rspamd-45df2c78a87700a7501fb889d5c2791b0d354348.zip
[Minor] Do not serve absent dkim private keys from LRU cache
-rw-r--r--src/libserver/dkim.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index c70b0bbc0..4b49d1e6f 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2736,11 +2736,16 @@ rspamd_dkim_sign_key_maybe_invalidate (rspamd_dkim_sign_key_t *key,
if (type == RSPAMD_DKIM_SIGN_KEY_FILE) {
gchar fpath[PATH_MAX];
+ if (len >= PATH_MAX) {
+ /* Bad thing */
+ return TRUE;
+ }
+
rspamd_snprintf (fpath, sizeof (fpath), "%*s", (gint) len, what);
if (stat (fpath, &st) == -1) {
- /* Prefer to use cached key since it is absent on FS */
- return FALSE;
+ /* Wrong: do NOT prefer to use cached key since it is absent on FS */
+ return TRUE;
}
if (st.st_mtime > key->mtime) {