summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweingart <weingart@openbsd.org>2009-04-07 16:06:37 +0000
committerweingart <weingart@openbsd.org>2009-04-07 16:06:37 +0000
commitd20b384c1bd16e1315d2af42e7d867e97e5680da (patch)
tree77aec6f68f9c97152ffbf431ccbd3f9927372f48
parentallow to specify an alternate control socket instead of /var/run/ospfd.sock. (diff)
downloadwireguard-openbsd-d20b384c1bd16e1315d2af42e7d867e97e5680da.tar.xz
wireguard-openbsd-d20b384c1bd16e1315d2af42e7d867e97e5680da.zip
Fix the default value to be between low/high range. Thanks for
frantisek holop pointing out the issue. ok deraadt@
-rw-r--r--sbin/fdisk/misc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c
index ad20c5dafee..ae0ecaa2bc3 100644
--- a/sbin/fdisk/misc.c
+++ b/sbin/fdisk/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.20 2008/12/01 20:15:35 ray Exp $ */
+/* $OpenBSD: misc.c,v 1.21 2009/04/07 16:06:37 weingart Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -98,7 +98,12 @@ ask_num(const char *str, int flags, int dflt, int low, int high,
do {
again:
- num = dflt;
+ if (dflt < low)
+ num = low;
+ else if (dflt > high)
+ num = high;
+ else
+ num = dflt;
if (flags == ASK_HEX)
printf("%s [%X - %X]: [%X] ", str, low, high, num);
else