Skip to content

Commit

Permalink
Buffer was one element too small, missing room for a null terminator.…
Browse files Browse the repository at this point in the history
… Reported by nhmall. See issue #295.
  • Loading branch information
Bill-Gray committed Jun 5, 2023
1 parent f8cacee commit 0a4e1e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pdcurses/getch.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ static int _paste(void)
return -1;

#ifdef PDC_WIDE
wpaste = (wchar_t *)malloc(len * sizeof(wchar_t));
len = (long)PDC_mbstowcs(wpaste, paste, len);
wpaste = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
len = (long)PDC_mbstowcs(wpaste, paste, len + 1);
#endif
newmax = len + SP->c_ungind;
if (newmax > SP->c_ungmax)
Expand Down

0 comments on commit 0a4e1e9

Please sign in to comment.