1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Extra allocation check during initialisation.

This commit is contained in:
Renaud 2015-03-24 17:49:12 +08:00
parent 5a900d59e6
commit cfed6fdddf

7
main.c
View File

@ -275,7 +275,12 @@ int main(int argc, char **argv)
unqname(bname); unqname(bname);
/* set this to inactive */ /* set this to inactive */
bp = bfind(bname, TRUE, 0); bp = bfind( bname, TRUE, 0) ;
if( bp == NULL) {
fputs( "Buffer creation failed!\n", stderr) ;
exit( EXIT_FAILURE) ;
}
strncpy( bp->b_fname, argv[ carg], sizeof bp->b_fname - 1) ; /* max filename length limited to NFILEN - 1 (79) */ strncpy( bp->b_fname, argv[ carg], sizeof bp->b_fname - 1) ; /* max filename length limited to NFILEN - 1 (79) */
bp->b_fname[ sizeof bp->b_fname - 1] = 0 ; bp->b_fname[ sizeof bp->b_fname - 1] = 0 ;
bp->b_active = FALSE; bp->b_active = FALSE;