1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 23:36:23 -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_mode = gmode;
bp->b_nwnd = 0; bp->b_nwnd = 0;
bp->b_linep = lp; bp->b_linep = lp;
strcpy(bp->b_fname, ""); bp->b_fname[ 0] = '\0' ;
strcpy(bp->b_bname, bname); strncpy( bp->b_bname, bname, sizeof( bname_t) - 1) ;
bp->b_bname[ sizeof( bname_t) - 1] = '\0' ;
#if CRYPT #if CRYPT
bp->b_key[0] = 0; bp->b_key[0] = 0;
#endif #endif