diff options
author | 2009-04-07 16:06:37 +0000 | |
---|---|---|
committer | 2009-04-07 16:06:37 +0000 | |
commit | d20b384c1bd16e1315d2af42e7d867e97e5680da (patch) | |
tree | 77aec6f68f9c97152ffbf431ccbd3f9927372f48 | |
parent | allow to specify an alternate control socket instead of /var/run/ospfd.sock. (diff) | |
download | wireguard-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.c | 9 |
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 |