0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

Fix for using ":wundo foo" when foo is an empty file.

This commit is contained in:
Bram Moolenaar 2010-05-25 22:09:21 +02:00
parent 64354da438
commit 83ad0147c0

View File

@ -1286,11 +1286,12 @@ u_write_undo(name, forceit, buf, hash)
}
else
{
char_u buf[2];
char_u buf[2];
int len;
vim_read(fd, buf, 2);
len = vim_read(fd, buf, 2);
close(fd);
if ((buf[0] << 8) + buf[1] != UF_START_MAGIC)
if (len < 2 || (buf[0] << 8) + buf[1] != UF_START_MAGIC)
{
if (name != NULL || p_verbose > 0)
smsg((char_u *)_("Will not overwrite, this is not an undo file: %s"),