comparison src/os_unix.c @ 9898:bff8a09016a5 v7.4.2223

commit https://github.com/vim/vim/commit/d3c907b5d2b352482b580a0cf687cbbea4c19ea1 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 17 21:32:09 2016 +0200 patch 7.4.2223 Problem: Buffer overflow when using latin1 character with feedkeys(). Solution: Check for an illegal character. Add a test.
author Christian Brabandt <cb@256bit.org>
date Wed, 17 Aug 2016 21:45:07 +0200
parents 043b7a9579e6
children 782a8070c3a6
comparison
equal deleted inserted replaced
9897:9d1354639a36 9898:bff8a09016a5
4804 /* Check if the last character in buffer[] is 4804 /* Check if the last character in buffer[] is
4805 * incomplete, keep these bytes for the next 4805 * incomplete, keep these bytes for the next
4806 * round. */ 4806 * round. */
4807 for (p = buffer; p < buffer + len; p += l) 4807 for (p = buffer; p < buffer + len; p += l)
4808 { 4808 {
4809 l = mb_cptr2len(p); 4809 l = MB_CPTR2LEN(p);
4810 if (l == 0) 4810 if (l == 0)
4811 l = 1; /* NUL byte? */ 4811 l = 1; /* NUL byte? */
4812 else if (MB_BYTE2LEN(*p) != l) 4812 else if (MB_BYTE2LEN(*p) != l)
4813 break; 4813 break;
4814 } 4814 }