From eb65aa32f77aab0e788c3700f3a16978836416d8 Mon Sep 17 00:00:00 2001 From: epoch Date: Sun, 14 Nov 2021 04:31:18 +0000 Subject: urimatch got an extra check to bail for inappropriate match pattern --- urimatch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'urimatch.c') 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; } - -- cgit v1.2.3