summaryrefslogtreecommitdiff
path: root/usr.bin/whois
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-09-18 22:16:16 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2003-09-18 22:16:16 +0000
commit9d2ee097e0fadcee53d5e06d503ce30a27790c30 (patch)
tree9613213d7ca53f37ae84cee889d6c5519d9778c7 /usr.bin/whois
parent8ef35e9b63553bfaa8f26c46fb48df86d8a40af1 (diff)
if length is 1, don't try to null memory that doesn't belong to us.
found by tedu@, ok by millert@ and him.
Diffstat (limited to 'usr.bin/whois')
-rw-r--r--usr.bin/whois/whois.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c
index bdec7611854..0cdf6685f78 100644
--- a/usr.bin/whois/whois.c
+++ b/usr.bin/whois/whois.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: whois.c,v 1.27 2003/06/10 22:20:54 deraadt Exp $ */
+/* $OpenBSD: whois.c,v 1.28 2003/09/18 22:16:15 fgsch Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: whois.c,v 1.27 2003/06/10 22:20:54 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: whois.c,v 1.28 2003/09/18 22:16:15 fgsch Exp $";
#endif
#endif /* not lint */
@@ -214,8 +214,8 @@ whois(const char *query, const char *server, const char *port, int flags)
p = buf + len - 1;
if (isspace((unsigned char)*p)) {
do
- *p-- = '\0';
- while (p != buf && isspace((unsigned char)*p));
+ *p = '\0';
+ while (p > buf && isspace((unsigned char)*--p));
} else {
if ((nbuf = malloc(len + 1)) == NULL)
err(1, "malloc");