1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-22 17:16:34 -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

5
main.c
View File

@ -276,6 +276,11 @@ int main(int argc, char **argv)
/* 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;