Fix CID114556: Copy into fixed size buffer.

This commit is contained in:
Renaud 2015-10-05 17:44:05 +08:00
parent 4feb70b484
commit e5e2ca0636
1 changed files with 3 additions and 1 deletions

View File

@ -254,7 +254,9 @@ ask:
bp = bp->b_bufp ; /* onward */
}
strcpy( curbp->b_bname, bufn) ; /* copy buffer name to structure */
/* copy buffer name to structure */
strncpy( curbp->b_bname, bufn, sizeof( bname_t) - 1) ;
curbp->b_bname[ sizeof( bname_t) - 1] = '\0' ;
free( bufn) ;
curwp->w_flag |= WFMODE ; /* make mode line replot */