Mercurial > vim
comparison src/misc2.c @ 3202:e757e1127d21 v7.3.371
updated for version 7.3.371
Problem: Crash in autocomplete. (Greg Weber)
Solution: Check not going over allocated buffer size.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 08 Dec 2011 17:49:35 +0100 |
parents | 4d4a328f199e |
children | 75217982ea46 |
comparison
equal
deleted
inserted
replaced
3201:afdc99e393fc | 3202:e757e1127d21 |
---|---|
4291 #endif | 4291 #endif |
4292 #ifdef FEAT_PATH_EXTRA | 4292 #ifdef FEAT_PATH_EXTRA |
4293 static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **)); | 4293 static int ff_path_in_stoplist __ARGS((char_u *, int, char_u **)); |
4294 #endif | 4294 #endif |
4295 | 4295 |
4296 static char_u e_pathtoolong[] = N_("E854: path too long for completion"); | |
4297 | |
4296 #if 0 | 4298 #if 0 |
4297 /* | 4299 /* |
4298 * if someone likes findfirst/findnext, here are the functions | 4300 * if someone likes findfirst/findnext, here are the functions |
4299 * NOT TESTED!! | 4301 * NOT TESTED!! |
4300 */ | 4302 */ |
4587 * string. | 4589 * string. |
4588 */ | 4590 */ |
4589 len = 0; | 4591 len = 0; |
4590 while (*wc_part != NUL) | 4592 while (*wc_part != NUL) |
4591 { | 4593 { |
4594 if (len + 5 >= MAXPATHL) | |
4595 { | |
4596 EMSG(_(e_pathtoolong)); | |
4597 break; | |
4598 } | |
4592 if (STRNCMP(wc_part, "**", 2) == 0) | 4599 if (STRNCMP(wc_part, "**", 2) == 0) |
4593 { | 4600 { |
4594 ff_expand_buffer[len++] = *wc_part++; | 4601 ff_expand_buffer[len++] = *wc_part++; |
4595 ff_expand_buffer[len++] = *wc_part++; | 4602 ff_expand_buffer[len++] = *wc_part++; |
4596 | 4603 |
4632 goto error_return; | 4639 goto error_return; |
4633 search_ctx->ffsc_fix_path[0] = NUL; | 4640 search_ctx->ffsc_fix_path[0] = NUL; |
4634 } | 4641 } |
4635 | 4642 |
4636 /* create an absolute path */ | 4643 /* create an absolute path */ |
4644 if (STRLEN(search_ctx->ffsc_start_dir) | |
4645 + STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) | |
4646 { | |
4647 EMSG(_(e_pathtoolong)); | |
4648 goto error_return; | |
4649 } | |
4637 STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir); | 4650 STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir); |
4638 add_pathsep(ff_expand_buffer); | 4651 add_pathsep(ff_expand_buffer); |
4639 STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path); | 4652 STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path); |
4640 add_pathsep(ff_expand_buffer); | 4653 add_pathsep(ff_expand_buffer); |
4641 | 4654 |