diff options
author | epoch <epoch@enzo.thebackupbox.net> | 2021-11-14 04:31:18 +0000 |
---|---|---|
committer | epoch <epoch@enzo.thebackupbox.net> | 2021-11-14 04:31:18 +0000 |
commit | eb65aa32f77aab0e788c3700f3a16978836416d8 (patch) | |
tree | 5800d4b121e3c56526ae68d1e4fb2f05558c55b6 /urimatch.c | |
parent | 74e3a7e1a9e9f2b24964403f2c2b75e1ddda3053 (diff) | |
download | uritools-eb65aa32f77aab0e788c3700f3a16978836416d8.tar.gz uritools-eb65aa32f77aab0e788c3700f3a16978836416d8.zip |
urimatch got an extra check to bail for inappropriate match pattern
Diffstat (limited to 'urimatch.c')
-rw-r--r-- | urimatch.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -63,6 +63,13 @@ int main(int argc,char *argv[]) { case 'r': j=1; rule=MATCH_REVERSE; break; default: break;//handled by the next switch } + if(rule != MATCH_UNEXIST) { + if(i+1 == argc) { + fprintf(stderr,"argument '%s' wants a value in the next argument and didn't get it. throwing a fit.\n",argv[i]); +// fprintf(stderr,"previous: '%s' current: '%s' next: '%s'\n",argv[i-1],argv[i],argv[i+1]); + return 2; + } + } switch(argv[i][j]) { case 's': if(match(rule,u.scheme,argv[i+1])) { printf("%s\n",copy); ret=0;} break; case 'u': if(match(rule,u.username,argv[i+1])) { printf("%s\n",copy); ret=0;} break; @@ -83,4 +90,3 @@ int main(int argc,char *argv[]) { } return ret; } - |