diff options
author | Bram Moolenaar <bram@vim.org> | 2011-12-08 17:49:35 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2011-12-08 17:49:35 +0100 |
commit | ebb13bb83a7e4e1de3a81a813a2b161612fec145 (patch) | |
tree | df305697c49a80804aeae2926fa7a58252267668 | |
parent | 7cfa3432e105b18bfc577eb0f4924a7dd09e7f61 (diff) | |
download | vim-ebb13bb83a7e4e1de3a81a813a2b161612fec145.tar.gz |
Problem: Crash in autocomplete. (Greg Weber)
Solution: Check not going over allocated buffer size.
-rw-r--r-- | src/misc2.c | 13 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/misc2.c b/src/misc2.c index 20ee1701..784e4889 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); diff --git a/src/version.c b/src/version.c index 145a1dcb..767103b9 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 371, +/**/ 370, /**/ 369, |