summaryrefslogtreecommitdiff
path: root/src/dosinst.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-22 19:41:08 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-22 19:41:08 +0100
commite4963c543ddcfc4845fa0d42893b6a4e1aa27c47 (patch)
tree843cef9d49d3104ef67078b87889c1d0f3b33a55 /src/dosinst.h
parentc666388367282c3c7d1d7af24883cfa0d40b046e (diff)
downloadvim-git-e4963c543ddcfc4845fa0d42893b6a4e1aa27c47.tar.gz
patch 8.1.0976: dosinstall still has buffer overflow problemsv8.1.0976
Problem: Dosinstall still has buffer overflow problems. Solution: Adjust buffer sizes. (Yasuhiro Matsumoto, closes #4002)
Diffstat (limited to 'src/dosinst.h')
-rw-r--r--src/dosinst.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dosinst.h b/src/dosinst.h
index f264f945e..7f30e90f4 100644
--- a/src/dosinst.h
+++ b/src/dosinst.h
@@ -59,7 +59,7 @@ char *searchpath(char *name);
/* ---------------------------------------- */
-#define BUFSIZE 512 /* long enough to hold a file name path */
+#define BUFSIZE (MAX_PATH*2) /* long enough to hold a file name path */
#define NUL 0
#define FAIL 0
@@ -93,15 +93,15 @@ int interactive; /* non-zero when running interactively */
static void *
alloc(int len)
{
- char *s;
+ void *p;
- s = malloc(len);
- if (s == NULL)
+ p = malloc(len);
+ if (p == NULL)
{
printf("ERROR: out of memory\n");
exit(1);
}
- return (void *)s;
+ return p;
}
/*
@@ -512,7 +512,7 @@ char *sysdrive; /* system drive or "c:\" */
do_inits(char **argv)
{
/* Find out the full path of our executable. */
- if (my_fullpath(installdir, argv[0], BUFSIZE) == NULL)
+ if (my_fullpath(installdir, argv[0], sizeof(installdir)) == NULL)
{
printf("ERROR: Cannot get name of executable\n");
myexit(1);