diff --git a/CHANGELOG b/CHANGELOG index b0bf1113d..85796e769 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o Nmap quits if you give a "backwards" port or protocol range like + -p 20-10. The issue was noted by Arturo "Buanzo" Busleiman. [David] + o Fixed a bug which caused Nmap to infer an improper distance against some hosts when performaing OS detection against a group whose distance varies between members. [David, Fyodor] diff --git a/nmap.cc b/nmap.cc index 0972587cd..6b5f86665 100644 --- a/nmap.cc +++ b/nmap.cc @@ -2347,6 +2347,11 @@ static void getpts_aux(const char *origexpr, int nested, u8 *porttbl, int range_ } else { fatal("Error #486: Your port specifications are illegal. Example of proper form: \"%s\"", syntax_example); } + if (rangeend < rangestart) { + fatal("Your %s range %ld-%ld is backwards. Did you mean %ld-%ld?", + (range_type & SCAN_PROTOCOLS) ? "protocol" : "port", + rangestart, rangeend, rangeend, rangestart); + } } else { fatal("Error #487: Your port specifications are illegal. Example of proper form: \"%s\"", syntax_example); }