From 3a06a6aab598920cf02a47fb4b132599515cded9 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Tue, 15 Oct 2019 14:33:02 +0800 Subject: [PATCH] Change ssl_init to use buffer pool for rand filename Upstream-commit: https://gitlab.com/muttmua/mutt/commit/140cd8853624cf1dfd00605191b55d600b3c572e Co-authored-by: Richard Russon --- conn/ssl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/conn/ssl.c b/conn/ssl.c index 70302f6cc..80e3238c6 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -588,20 +588,22 @@ static int ssl_init(void) if (!HAVE_ENTROPY()) { /* load entropy from files */ - char path[PATH_MAX]; + struct Buffer *path = mutt_buffer_pool_get(); add_entropy(C_EntropyFile); - add_entropy(RAND_file_name(path, sizeof(path))); + add_entropy(RAND_file_name(path->data, path->dsize)); /* load entropy from egd sockets */ #ifdef HAVE_RAND_EGD add_entropy(mutt_str_getenv("EGDSOCKET")); - snprintf(path, sizeof(path), "%s/.entropy", NONULL(HomeDir)); - add_entropy(path); + mutt_buffer_printf(path, "%s/.entropy", NONULL(HomeDir)); + add_entropy(mutt_b2s(path)); add_entropy("/tmp/entropy"); #endif /* shuffle $RANDFILE (or ~/.rnd if unset) */ - RAND_write_file(RAND_file_name(path, sizeof(path))); + RAND_write_file(RAND_file_name(path->data, path->dsize)); + mutt_buffer_pool_release(&path); + mutt_clear_error(); if (!HAVE_ENTROPY()) { -- 2.40.0