From c0ad899d577b638bb47321d1dda79ee940e18d6f Mon Sep 17 00:00:00 2001 From: fyodor Date: Sat, 11 Aug 2007 05:08:37 +0000 Subject: [PATCH] merge soc07 r5069:5072 - Fix for character case bug in wildtest found by David; Nicer error message for anyone dumb enough to use negative frequency values. --- services.cc | 3 +++ utils.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/services.cc b/services.cc index c94385705..c0185080b 100644 --- a/services.cc +++ b/services.cc @@ -174,6 +174,9 @@ static int nmap_services_init() { if (res == 3) { ratio = 0; } else if (res == 5) { + if (ratio_n < 0 || ratio_d < 0) + fatal("%s:%d contains an invalid negative value", filename, lineno); + if (ratio_n > ratio_d) fatal("%s:%d has a ratio %g. All ratios must be < 1", filename, lineno, (double)ratio_n/ratio_d); diff --git a/utils.cc b/utils.cc index ba250d35e..1d97b6119 100644 --- a/utils.cc +++ b/utils.cc @@ -128,8 +128,8 @@ int wildtest(char *wild, char *test) { if (wild[1] == '\0') return 1; for(i=0; test[i]!='\0'; i++) - if ((wild[1] == test[i] || wild[1] == '?') - && wildtest(wild+1, test+i) == 1) return 1; + if ((tolower((int)wild[1]) == tolower((int)test[i]) || wild[1] == '?') + && wildtest(wild+1, test+i) == 1) return 1; return 0; }