Fix CID#39937 Copy into fixed size buffer.

This commit is contained in:
Renaud 2015-07-17 10:44:35 +08:00
parent dfc9a50fcf
commit 2522a858c1
1 changed files with 8 additions and 9 deletions

13
input.c
View File

@ -645,14 +645,13 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
}
strcpy( tmp, "/tmp/meXXXXXX") ;
strcpy(ffbuf, "echo ");
strcat(ffbuf, buf);
if (!iswild)
strcat(ffbuf, "*");
strcat(ffbuf, " >");
xmkstemp( tmp) ;
strcat(ffbuf, tmp);
strcat(ffbuf, " 2>&1");
if( strlen( buf) < sizeof ffbuf - 26 - 1)
sprintf( ffbuf, "echo %s%s >%s 2>&1", buf,
!iswild ? "*" : "", tmp) ;
else
sprintf( ffbuf, "echo ERROR >%s 2>&1", tmp) ;
ue_system( ffbuf) ;
tmpf = fopen(tmp, "r");
#endif