summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-12-08 17:49:35 +0100
committerBram Moolenaar <Bram@vim.org>2011-12-08 17:49:35 +0100
commitb9ba403542b4bbd37ea10a4d7db7e307e0108de8 (patch)
tree87c6d78588c3fcc1f5d97ebd00a26cd09c26d341 /src/misc2.c
parentfa263a517b5e6c11055fa8fe8517f6a3e102ccc6 (diff)
downloadvim-git-b9ba403542b4bbd37ea10a4d7db7e307e0108de8.tar.gz
updated for version 7.3.371v7.3.371
Problem: Crash in autocomplete. (Greg Weber) Solution: Check not going over allocated buffer size.
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 20ee1701b..784e4889f 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -4293,6 +4293,8 @@ static ff_stack_T *ff_create_stack_element __ARGS((char_u *, int, int));
static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **));
#endif
+static char_u e_pathtoolong[] = N_("E854: path too long for completion");
+
#if 0
/*
* if someone likes findfirst/findnext, here are the functions
@@ -4589,6 +4591,11 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
len = 0;
while (*wc_part != NUL)
{
+ if (len + 5 >= MAXPATHL)
+ {
+ EMSG(_(e_pathtoolong));
+ break;
+ }
if (STRNCMP(wc_part, "**", 2) == 0)
{
ff_expand_buffer[len++] = *wc_part++;
@@ -4634,6 +4641,12 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
}
/* create an absolute path */
+ if (STRLEN(search_ctx->ffsc_start_dir)
+ + STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL)
+ {
+ EMSG(_(e_pathtoolong));
+ goto error_return;
+ }
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
add_pathsep(ff_expand_buffer);
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);