Skip to content

Commit

Permalink
Improved filtering of input for fuzzershell for modes other than gene…
Browse files Browse the repository at this point in the history
…ric.
  • Loading branch information
D. Richard Hipp committed Apr 22, 2015
1 parent 641bef9 commit 8152ad3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tool/fuzzershell.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ int main(int argc, char **argv){
char *zSql; /* SQL to run */
char *zToFree = 0; /* Call sqlite3_free() on this afte running zSql */
int iMode = FZMODE_Generic; /* Operating mode */
const char *zCkGlob = 0; /* Inputs must match this glob */


g.zArgv0 = argv[0];
Expand Down Expand Up @@ -392,12 +393,16 @@ int main(int argc, char **argv){
z = argv[++i];
if( strcmp(z,"generic")==0 ){
iMode = FZMODE_Printf;
zCkGlob = 0;
}else if( strcmp(z, "glob")==0 ){
iMode = FZMODE_Glob;
zCkGlob = "'*','*'";
}else if( strcmp(z, "printf")==0 ){
iMode = FZMODE_Printf;
zCkGlob = "'*',*";
}else if( strcmp(z, "strftime")==0 ){
iMode = FZMODE_Strftime;
zCkGlob = "'*',*";
}else{
abendError("unknown --mode: %s", z);
}
Expand Down Expand Up @@ -487,7 +492,7 @@ int main(int argc, char **argv){
for(iNext=i; iNext<nIn && strncmp(&zIn[iNext],"/****<",6)!=0; iNext++){}
cSaved = zIn[iNext];
zIn[iNext] = 0;
if( iMode!=FZMODE_Generic && sqlite3_strglob("'*',*",&zIn[i])!=0 ){
if( zCkGlob && sqlite3_strglob(zCkGlob,&zIn[i])!=0 ){
zIn[iNext] = cSaved;
continue;
}
Expand Down

0 comments on commit 8152ad3

Please sign in to comment.