Mercurial > vim
comparison src/insexpand.c @ 29436:6888567953ca v9.0.0060
patch 9.0.0060: accessing uninitialized memory when completing long line
Commit: https://github.com/vim/vim/commit/b9e717367c395490149495cf375911b5d9de889e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 23 06:53:08 2022 +0100
patch 9.0.0060: accessing uninitialized memory when completing long line
Problem: Accessing uninitialized memory when completing long line.
Solution: Terminate string with NUL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 23 Jul 2022 08:00:03 +0200 |
parents | 722a50132db9 |
children | 827d9f2b7a71 |
comparison
equal
deleted
inserted
replaced
29435:119cdb105611 | 29436:6888567953ca |
---|---|
640 // ASCII characters, and we also need one byte for NUL, so when | 640 // ASCII characters, and we also need one byte for NUL, so when |
641 // getting to six bytes from the edge of IObuff switch to using a | 641 // getting to six bytes from the edge of IObuff switch to using a |
642 // growarray. Add the character in the next round. | 642 // growarray. Add the character in the next round. |
643 if (ga_grow(&gap, IOSIZE) == FAIL) | 643 if (ga_grow(&gap, IOSIZE) == FAIL) |
644 return (char_u *)"[failed]"; | 644 return (char_u *)"[failed]"; |
645 *p = NUL; | |
645 STRCPY(gap.ga_data, IObuff); | 646 STRCPY(gap.ga_data, IObuff); |
646 gap.ga_len = (int)STRLEN(IObuff); | 647 gap.ga_len = (int)STRLEN(IObuff); |
647 } | 648 } |
648 else if (has_mbyte) | 649 else if (has_mbyte) |
649 p += (*mb_char2bytes)(wca[i++], p); | 650 p += (*mb_char2bytes)(wca[i++], p); |