mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 23:36:23 -05:00
Use strncpy instead of strcpy. (CID 39928 eval, 39931 file, 39932 exec, 39938 bind).
This commit is contained in:
parent
eb7217f8ec
commit
8de64f81be
3
bind.c
3
bind.c
@ -352,7 +352,8 @@ static int buildlist( char *mstring)
|
||||
continue ;
|
||||
#endif
|
||||
/* add in the command name */
|
||||
strcpy(outseq, nptr->n_name);
|
||||
strncpy( outseq, nptr->n_name, sizeof outseq - 1) ;
|
||||
outseq[ sizeof outseq - 1] = '\0' ;
|
||||
cpos = strlen(outseq);
|
||||
|
||||
/* search down any keys bound to this */
|
||||
|
8
eval.c
8
eval.c
@ -796,9 +796,11 @@ int setvar(int f, int n)
|
||||
}
|
||||
|
||||
/* get the value for that variable */
|
||||
if (f == TRUE)
|
||||
strcpy(value, i_to_a(n));
|
||||
else {
|
||||
if( f == TRUE) {
|
||||
/* a bit overcautious here in using strncpy */
|
||||
strncpy( value, i_to_a( n), sizeof value - 1) ;
|
||||
value[ sizeof value - 1] = '\0' ;
|
||||
} else {
|
||||
status = mlreply( "Value: ", value, sizeof value);
|
||||
if (status != TRUE)
|
||||
return status;
|
||||
|
3
exec.c
3
exec.c
@ -176,7 +176,8 @@ static int docmd( char *cline) {
|
||||
/* process leadin argument */
|
||||
if( !is_it_cmd( tkn)) {
|
||||
f = TRUE;
|
||||
strcpy(tkn, getval(tkn));
|
||||
strncpy( tkn, getval( tkn), sizeof tkn - 1) ;
|
||||
tkn[ sizeof tkn - 1] = '\0' ;
|
||||
n = atoi(tkn);
|
||||
|
||||
/* and now get the command to execute */
|
||||
|
3
file.c
3
file.c
@ -325,7 +325,8 @@ int readin(const char *fname, boolean lockfl)
|
||||
if ((s = bclear(bp)) != TRUE) /* Might be old. */
|
||||
return s;
|
||||
bp->b_flag &= ~(BFINVS | BFCHG);
|
||||
strcpy(bp->b_fname, fname);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user