summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2017-11-08 17:27:40 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2017-11-08 17:27:40 +0000
commitb2d6ebe287169f83fd459808f224c56736c2f77f (patch)
tree226ce531ef6d67ea93048f77e1491b569133fa79 /sbin
parentf54eb2d6ca43f5a8e44a80cad1a1fba7f37fb846 (diff)
Add a type cast to force signed comparison. This fixes a loop
termination issue that can arise when parsing IP options. The bug was found by Hrvoje Popovski with ping -R. Fix tested by Hrvoje, OK millert@
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 5f21e7919c3..8e50be2cae9 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.223 2017/07/08 16:22:29 florian Exp $ */
+/* $OpenBSD: ping.c,v 1.224 2017/11/08 17:27:39 visa Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -1325,7 +1325,7 @@ pr_ipopt(int hlen, u_char *buf)
s_in.sin_len = sizeof(s_in);
s_in.sin_family = AF_INET;
- for (; hlen > sizeof(struct ip); --hlen, ++cp) {
+ for (; hlen > (int)sizeof(struct ip); --hlen, ++cp) {
switch (*cp) {
case IPOPT_EOL:
hlen = 0;