Mercurial > vim
diff src/uninstal.c @ 15941:b9098585d945 v8.1.0976
patch 8.1.0976: dosinstall still has buffer overflow problems
commit https://github.com/vim/vim/commit/e4963c543ddcfc4845fa0d42893b6a4e1aa27c47
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 22 19:41:08 2019 +0100
patch 8.1.0976: dosinstall still has buffer overflow problems
Problem: Dosinstall still has buffer overflow problems.
Solution: Adjust buffer sizes. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/4002)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 22 Feb 2019 19:45:12 +0100 |
parents | e43b5e6d9190 |
children |
line wrap: on
line diff
--- a/src/uninstal.c +++ b/src/uninstal.c @@ -60,11 +60,10 @@ reg_delete_key(HKEY hRootKey, const char * Returns non-zero when it's found. */ static int -popup_gvim_path(char *buf) +popup_gvim_path(char *buf, DWORD bufsize) { HKEY key_handle; DWORD value_type; - DWORD bufsize = BUFSIZE; int r; /* Open the key where the path to gvim.exe is stored. */ @@ -87,11 +86,10 @@ popup_gvim_path(char *buf) * Returns non-zero when it's found. */ static int -openwith_gvim_path(char *buf) +openwith_gvim_path(char *buf, DWORD bufsize) { HKEY key_handle; DWORD value_type; - DWORD bufsize = BUFSIZE; int r; /* Open the key where the path to gvim.exe is stored. */ @@ -209,7 +207,7 @@ batfile_thisversion(char *path) fd = fopen(path, "r"); if (fd != NULL) { - while (fgets(line, BUFSIZE, fd) != NULL) + while (fgets(line, sizeof(line), fd) != NULL) { for (p = line; *p != 0; ++p) /* don't accept "vim60an" when looking for "vim60". */ @@ -335,7 +333,7 @@ main(int argc, char *argv[]) printf("This program will remove the following items:\n"); - if (popup_gvim_path(popup_path)) + if (popup_gvim_path(popup_path, sizeof(popup_path))) { printf(" - the \"Edit with Vim\" entry in the popup menu\n"); printf(" which uses \"%s\"\n", popup_path); @@ -349,7 +347,7 @@ main(int argc, char *argv[]) remove_openwith(); } } - else if (openwith_gvim_path(popup_path)) + else if (openwith_gvim_path(popup_path, sizeof(popup_path))) { printf(" - the Vim \"Open With...\" entry in the popup menu\n"); printf(" which uses \"%s\"\n", popup_path);