mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 06:57:11 -05:00
Use temporary buffer in nextarg to avoid issue with strncpy under Linux.
This commit is contained in:
parent
fe1eaf7348
commit
bc90c36603
8
exec.c
8
exec.c
@ -310,16 +310,20 @@ int macarg( char *tok, int toksz)
|
||||
*/
|
||||
int nextarg(const char *prompt, char *buffer, int size, int terminator)
|
||||
{
|
||||
char *tmpbuf ;
|
||||
|
||||
/* if we are interactive, go get it! */
|
||||
if (clexec == FALSE)
|
||||
return getstring(prompt, buffer, size, terminator);
|
||||
|
||||
tmpbuf = malloc( size) ;
|
||||
/* grab token and advance past */
|
||||
gettoken( buffer, size) ;
|
||||
gettoken( tmpbuf, size) ;
|
||||
|
||||
/* evaluate it */
|
||||
strncpy( buffer, getval( buffer), size - 1) ;
|
||||
strncpy( buffer, getval( tmpbuf), size - 1) ;
|
||||
buffer[ size - 1] = '\0' ;
|
||||
free( tmpbuf) ;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user