1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-21 00:26:27 -05:00

Avoid copy to buffer name using same source as destination to accomodate sensitive implementation of str(n)cpy.

This commit is contained in:
Renaud 2017-05-02 12:15:19 +08:00
parent 19e33fef82
commit 7f8ab2d2a5

2
file.c
View File

@ -283,8 +283,10 @@ int readin(const char *fname, boolean lockfl)
return status ;
bp->b_flag &= ~(BFINVS | BFCHG);
if( fname != bp->b_fname) { /* Copy if source differs from destination */
strncpy( bp->b_fname, fname, sizeof( fname_t) - 1) ;
bp->b_fname[ sizeof( fname_t) - 1] = '\0' ;
}
/* let a user macro get hold of things...if he wants */
execute(META | SPEC | 'R', FALSE, 1);