Mercurial > vim
changeset 2780:5ddb68c2a845 v7.3.166
updated for version 7.3.166
Problem: Buffer on the stack may be too big
Solution: Allocate the space.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 28 Apr 2011 17:24:58 +0200 |
parents | bf19f6620521 |
children | 35c561d1583a |
files | src/option.c src/version.c |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/option.c +++ b/src/option.c @@ -9185,7 +9185,7 @@ put_setstring(fd, cmd, name, valuep, exp int expand; { char_u *s; - char_u buf[MAXPATHL]; + char_u *buf; if (fprintf(fd, "%s %s=", cmd, name) < 0) return FAIL; @@ -9203,9 +9203,16 @@ put_setstring(fd, cmd, name, valuep, exp } else if (expand) { + buf = alloc(MAXPATHL); + if (buf == NULL) + return FAIL; home_replace(NULL, *valuep, buf, MAXPATHL, FALSE); if (put_escstr(fd, buf, 2) == FAIL) + { + vim_free(buf); return FAIL; + } + vim_free(buf); } else if (put_escstr(fd, *valuep, 2) == FAIL) return FAIL;