1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2016-09-25 20:54:11 +02:00
parent 3f1c15b24a
commit 680e015bfe
5 changed files with 49 additions and 0 deletions

View File

@@ -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);