1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Fix expr_match bug

This commit is contained in:
dmiller
2023-12-05 21:47:33 +00:00
parent f3f9ca7a8b
commit e47b742669
2 changed files with 2 additions and 1 deletions

View File

@@ -371,7 +371,7 @@ bool expr_match(const char *val, size_t vlen, const char *expr, size_t explen, b
}
goto next_expr;
} else {
q1 = strchr_p(p, p_end, '-');
q1 = strchr_p(p, q ? q : p_end, '-');
if (q1 != NULL) {
size_t sublen1 = q1 - p;
if ((vlen > sublen1)

View File

@@ -152,6 +152,7 @@ const struct expr_test tests[] = {
{"M[500|5B4]ST11NW[7-9]", "M5B4ST11NW79", false},
{"M[500|5B4]ST11NW[7-9]", "M500ST11NWA", false},
{"M[500|5B4]ST11NW[7-9]", "M5B40ST11NW9", false},
{"A|20-22", "A", true},
{"", "", true}
};