commit | 6281815eccc3ded54960f7798833ceb39561b9a0 | [log] [tgz] |
---|---|---|
author | Bram Moolenaar <Bram@vim.org> | Sun Feb 14 15:37:30 2021 +0100 |
committer | Bram Moolenaar <Bram@vim.org> | Sun Feb 14 15:37:30 2021 +0100 |
tree | 72c092d24c42b3e01f2dc184ba05c71e61bddf3a | |
parent | 2379f87eb48a4ee6a1d0fc7df964e12a3efe4fd5 [diff] [blame] |
patch 8.2.2515: memory access error when truncating an empty message Problem: Memory access error when truncating an empty message. Solution: Check for an empty string. (Dominique Pellé, closes #7841)
diff --git a/src/message.c b/src/message.c index 8adc224..012811f 100644 --- a/src/message.c +++ b/src/message.c
@@ -248,6 +248,13 @@ int i; int n; + if (*s == NUL) + { + if (buflen > 0) + *buf = NUL; + return; + } + if (room_in < 3) room = 0; half = room / 2;