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

17
input.c
View File

@ -644,15 +644,14 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
unlink( tmp) ;
}
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");
strcpy( tmp, "/tmp/meXXXXXX") ;
xmkstemp( tmp) ;
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