mirror of
https://github.com/rfivet/uemacs.git
synced 2025-04-22 02:42:18 -04: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 ;
|
continue ;
|
||||||
#endif
|
#endif
|
||||||
/* add in the command name */
|
/* 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);
|
cpos = strlen(outseq);
|
||||||
|
|
||||||
/* search down any keys bound to this */
|
/* 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 */
|
/* get the value for that variable */
|
||||||
if (f == TRUE)
|
if( f == TRUE) {
|
||||||
strcpy(value, i_to_a(n));
|
/* a bit overcautious here in using strncpy */
|
||||||
else {
|
strncpy( value, i_to_a( n), sizeof value - 1) ;
|
||||||
|
value[ sizeof value - 1] = '\0' ;
|
||||||
|
} else {
|
||||||
status = mlreply( "Value: ", value, sizeof value);
|
status = mlreply( "Value: ", value, sizeof value);
|
||||||
if (status != TRUE)
|
if (status != TRUE)
|
||||||
return status;
|
return status;
|
||||||
|
3
exec.c
3
exec.c
@ -176,7 +176,8 @@ static int docmd( char *cline) {
|
|||||||
/* process leadin argument */
|
/* process leadin argument */
|
||||||
if( !is_it_cmd( tkn)) {
|
if( !is_it_cmd( tkn)) {
|
||||||
f = TRUE;
|
f = TRUE;
|
||||||
strcpy(tkn, getval(tkn));
|
strncpy( tkn, getval( tkn), sizeof tkn - 1) ;
|
||||||
|
tkn[ sizeof tkn - 1] = '\0' ;
|
||||||
n = atoi(tkn);
|
n = atoi(tkn);
|
||||||
|
|
||||||
/* and now get the command to execute */
|
/* 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. */
|
if ((s = bclear(bp)) != TRUE) /* Might be old. */
|
||||||
return s;
|
return s;
|
||||||
bp->b_flag &= ~(BFINVS | BFCHG);
|
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 */
|
/* let a user macro get hold of things...if he wants */
|
||||||
execute(META | SPEC | 'R', FALSE, 1);
|
execute(META | SPEC | 'R', FALSE, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user