mirror of
https://github.com/nmap/nmap.git
synced 2025-12-16 12:49:02 +00:00
Reworked expression for readability.
This commit is contained in:
@@ -61,6 +61,8 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define IN_RANGE(x, min, max) ((x) >= (min) && (x) <= (max))
|
||||||
|
|
||||||
|
|
||||||
struct proxy_parser {
|
struct proxy_parser {
|
||||||
int done;
|
int done;
|
||||||
@@ -285,7 +287,7 @@ static int uri_parse_authority(const char *authority, struct uri *uri) {
|
|||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
n = parse_long(portsep + 1, &tail);
|
n = parse_long(portsep + 1, &tail);
|
||||||
if (errno != 0 || *tail != '\0' || tail == portsep + 1 || n < 1 || n > 65535)
|
if (errno || *tail || (tail == (portsep + 1)) || !IN_RANGE(n, 1, 65535))
|
||||||
return -1;
|
return -1;
|
||||||
uri->port = n;
|
uri->port = n;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user