1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-20 16:22:38 -05:00

CID 39925: Missing size check on buffer name when creating a new buffer.

This commit is contained in:
Renaud 2015-03-16 13:24:08 +08:00
parent d56b3af45a
commit 5f9de6bb89

View File

@ -528,8 +528,9 @@ struct buffer *bfind( const char *bname, int cflag, int bflag)
bp->b_mode = gmode;
bp->b_nwnd = 0;
bp->b_linep = lp;
strcpy(bp->b_fname, "");
strcpy(bp->b_bname, bname);
bp->b_fname[ 0] = '\0' ;
strncpy( bp->b_bname, bname, sizeof( bname_t) - 1) ;
bp->b_bname[ sizeof( bname_t) - 1] = '\0' ;
#if CRYPT
bp->b_key[0] = 0;
#endif