diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index 6fd7e1cb8eda..4115f4434e65 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -193,6 +193,8 @@ choose_server(char *domain) errx(EX_USAGE, "can't search for a null string"); while (pos > domain && *pos != '.') --pos; + if (pos <= domain) + return (NULL); if (isdigit((unsigned char)*++pos)) s_asprintf(&retval, "%s", ANICHOST); else