From: Paul Eggert Date: Mon, 15 May 2023 01:51:22 +0000 (-0700) Subject: Fix ebrowse -f buffer overflow X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e3f34d71e9c3c6c943580dc822afed7a3b0a861;p=emacs.git Fix ebrowse -f buffer overflow * lib-src/ebrowse.c (main): Fix buffer overflow when several -f options are given. Found by GCC 13 -Wanalyzer-allocation-size. --- diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 371fa6c938b..4b71f7447e0 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -3767,8 +3767,9 @@ main (int argc, char **argv) if (n_input_files == input_filenames_size) { input_filenames_size = max (10, 2 * input_filenames_size); - input_filenames = (char **) xrealloc ((void *)input_filenames, - input_filenames_size); + input_filenames = xrealloc (input_filenames, + (input_filenames_size + * sizeof *input_filenames)); } input_filenames[n_input_files++] = xstrdup (optarg); break;