diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-02-28 19:09:39 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-28 19:19:34 -0500 |
commit | 0c5f74ae4da7dbd5f95db009588681e8cc25a49e (patch) | |
tree | 3f4019be78c1c8f0d3c3912a997c50a95abb4055 | |
parent | 0c2ba7554fe6b1b821ad662872ab6b13dd0487d3 (diff) | |
download | rneovim-0c5f74ae4da7dbd5f95db009588681e8cc25a49e.tar.gz rneovim-0c5f74ae4da7dbd5f95db009588681e8cc25a49e.tar.bz2 rneovim-0c5f74ae4da7dbd5f95db009588681e8cc25a49e.zip |
coverity/56808: STRING_OVERFLOW
This was caught by FORTIFY_SOURCE (and coverity).
Fixes #4371
-rw-r--r-- | src/nvim/quickfix.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f3abf864fb..4a8391430b 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -2299,13 +2299,15 @@ static void qf_fill_buffer(qf_info_T *qi) if (qfp->qf_fnum != 0 && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL && errbuf->b_fname != NULL) { - if (qfp->qf_type == 1) /* :helpgrep */ - STRCPY(IObuff, path_tail(errbuf->b_fname)); - else - STRCPY(IObuff, errbuf->b_fname); + if (qfp->qf_type == 1) { // :helpgrep + STRLCPY(IObuff, path_tail(errbuf->b_fname), sizeof(IObuff)); + } else { + STRLCPY(IObuff, errbuf->b_fname, sizeof(IObuff)); + } len = (int)STRLEN(IObuff); - } else + } else { len = 0; + } IObuff[len++] = '|'; if (qfp->qf_lnum > 0) { |