mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-28 21:08:35 +00:00
Avoid division by zero with unlucky choices of max-port and min-port.
This commit is contained in:
1 file changed
+1
-1
+1
-1
@@ -1379,7 +1379,7 @@ int local_bind(int fd, union mysockaddr *addr, char *intname, unsigned int ifind
|
|||||||
/* cannot set source _port_ for TCP connections. */
|
/* cannot set source _port_ for TCP connections. */
|
||||||
if (is_tcp)
|
if (is_tcp)
|
||||||
port = 0;
|
port = 0;
|
||||||
else if (port == 0 && daemon->max_port != 0)
|
else if (port == 0 && daemon->max_port != 0 && daemon->max_port >= daemon->min_port)
|
||||||
{
|
{
|
||||||
/* Bind a random port within the range given by min-port and max-port if either
|
/* Bind a random port within the range given by min-port and max-port if either
|
||||||
or both are set. Otherwise use the OS's random ephemeral port allocation by
|
or both are set. Otherwise use the OS's random ephemeral port allocation by
|
||||||
|
|||||||
Reference in new issue
Block a user