]> granicus.if.org Git - mutt/commitdiff
Change ssl_init to use buffer pool for rand filename.
authorKevin McCarthy <kevin@8t8.us>
Tue, 15 Oct 2019 06:33:02 +0000 (14:33 +0800)
committerKevin McCarthy <kevin@8t8.us>
Tue, 15 Oct 2019 06:33:02 +0000 (14:33 +0800)
mutt_ssl.c

index 9df7096a0be28171c8dcc1137409f77ad28d2153..3dee74c6f812b75df7d8b89e6af9f0e2dfeff775 100644 (file)
@@ -326,7 +326,7 @@ bail:
  */
 static int ssl_init (void)
 {
-  char path[_POSIX_PATH_MAX];
+  BUFFER *path = NULL;
   static unsigned char init_complete = 0;
 
   if (init_complete)
@@ -336,18 +336,22 @@ static int ssl_init (void)
   {
     /* load entropy from files */
     add_entropy (SslEntropyFile);
-    add_entropy (RAND_file_name (path, sizeof (path)));
+
+    path = mutt_buffer_pool_get ();
+    add_entropy (RAND_file_name (path->data, path->dsize));
 
     /* load entropy from egd sockets */
 #ifdef HAVE_RAND_EGD
     add_entropy (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())
     {