summaryrefslogtreecommitdiff
path: root/urimatch.c
diff options
context:
space:
mode:
authorepoch <epoch@enzo.thebackupbox.net>2021-11-14 04:31:18 +0000
committerepoch <epoch@enzo.thebackupbox.net>2021-11-14 04:31:18 +0000
commiteb65aa32f77aab0e788c3700f3a16978836416d8 (patch)
tree5800d4b121e3c56526ae68d1e4fb2f05558c55b6 /urimatch.c
parent74e3a7e1a9e9f2b24964403f2c2b75e1ddda3053 (diff)
downloaduritools-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.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/urimatch.c b/urimatch.c
index 91177f2..641ed45 100644
--- a/urimatch.c
+++ b/urimatch.c
@@ -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;
}
-