patch 8.1.0976: dosinstall still has buffer overflow problems
Problem: Dosinstall still has buffer overflow problems.
Solution: Adjust buffer sizes. (Yasuhiro Matsumoto, closes #4002)
diff --git a/src/uninstal.c b/src/uninstal.c
index d0d0b06..7b7e3ef 100644
--- a/src/uninstal.c
+++ b/src/uninstal.c
@@ -60,11 +60,10 @@
* 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 @@
* 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 @@
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 @@
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 @@
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);