Mercurial > vim
diff src/fileio.c @ 10221:fb1fde4fcff7 v8.0.0010
commit https://github.com/vim/vim/commit/680e015bfe19be6772d3bd754486fbd45c1a9d3b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 25 20:54:11 2016 +0200
patch 8.0.0010
Problem: Crash when editing file that starts with crypt yeader. (igor2x)
Solution: Check for length of text. (Christian Brabandt) Add a test.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 25 Sep 2016 21:00:04 +0200 |
parents | 1de911ef1edf |
children | 01a5f64a7a20 |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -3011,6 +3011,9 @@ check_for_cryptkey( /* Remove cryptmethod specific header from the text. */ header_len = crypt_get_header_len(method); + if (*sizep <= header_len) + /* invalid header, buffer can't be encrypted */ + return NULL; *filesizep += header_len; *sizep -= header_len; mch_memmove(ptr, ptr + header_len, (size_t)*sizep);