diff options
author | 2009-08-31 08:01:33 +0000 | |
---|---|---|
committer | 2009-08-31 08:01:33 +0000 | |
commit | 47b9495e27dea3284a9031f50adba66b4ffb9231 (patch) | |
tree | 8e46984623c8919f4e1d1ff9542504782c957a4c | |
parent | IPV6_V6ONLY is defined in RFC 3493, not 3542; (diff) | |
download | wireguard-openbsd-47b9495e27dea3284a9031f50adba66b4ffb9231.tar.xz wireguard-openbsd-47b9495e27dea3284a9031f50adba66b4ffb9231.zip |
Don't get stuck in an infinite loop comparing u_short <= USHRT_MAX which
can happen if a nat port command with a end range of 65535 is used.
See also http://www.freebsd.org/cgi/query-pr.cgi?pr=136893
From FreeBSD via brad.
-rw-r--r-- | usr.sbin/ppp/ppp/nat_cmd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/ppp/ppp/nat_cmd.c b/usr.sbin/ppp/ppp/nat_cmd.c index 8930884a819..735e71d7286 100644 --- a/usr.sbin/ppp/ppp/nat_cmd.c +++ b/usr.sbin/ppp/ppp/nat_cmd.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: nat_cmd.c,v 1.26 2005/07/26 01:32:25 brad Exp $ + * $OpenBSD: nat_cmd.c,v 1.27 2009/08/31 08:01:33 claudio Exp $ */ #include <sys/param.h> @@ -173,7 +173,7 @@ nat_RedirectPort(struct cmdargs const *arg) return -1; } - while (laliasport <= haliasport) { + do { link = PacketAliasRedirectPort(localaddr, htons(llocalport), remoteaddr, htons(lremoteport), aliasaddr, htons(laliasport), @@ -185,10 +185,9 @@ nat_RedirectPort(struct cmdargs const *arg) return 1; } llocalport++; - laliasport++; if (hremoteport) lremoteport++; - } + } while (laliasport++ < haliasport); return 0; } |