coverity/56808: STRING_OVERFLOW

This was caught by FORTIFY_SOURCE (and coverity).

Fixes #4371
This commit is contained in:
Justin M. Keyes 2016-02-28 19:09:39 -05:00
parent 0c2ba7554f
commit 0c5f74ae4d

View File

@ -2299,13 +2299,15 @@ static void qf_fill_buffer(qf_info_T *qi)
if (qfp->qf_fnum != 0 if (qfp->qf_fnum != 0
&& (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
&& errbuf->b_fname != NULL) { && errbuf->b_fname != NULL) {
if (qfp->qf_type == 1) /* :helpgrep */ if (qfp->qf_type == 1) { // :helpgrep
STRCPY(IObuff, path_tail(errbuf->b_fname)); STRLCPY(IObuff, path_tail(errbuf->b_fname), sizeof(IObuff));
else } else {
STRCPY(IObuff, errbuf->b_fname); STRLCPY(IObuff, errbuf->b_fname, sizeof(IObuff));
}
len = (int)STRLEN(IObuff); len = (int)STRLEN(IObuff);
} else } else {
len = 0; len = 0;
}
IObuff[len++] = '|'; IObuff[len++] = '|';
if (qfp->qf_lnum > 0) { if (qfp->qf_lnum > 0) {