--- do_whois.c.old 2004-01-03 21:38:07.000000000 -0800 +++ do_whois.c 2006-08-23 11:09:24.000000000 -0700 @@ -12,13 +12,14 @@ #ifndef lint -static char rcsid[] = "@(#) $Id: do_whois.c,v 1.9 2004/01/04 05:33:49 dan Exp $"; +static char rcsid[] = "@(#) $Id: do_whois.c,v 1.10 2006/08/22 01:17:21 danx Exp $"; #endif #define SWHOISD_CONF SYSCONFDIR "/swhoisd.conf" #define SWHOISD_hdr SYSCONFDIR "/swhoisd.header" #define SWHOISD_FOOTER SYSCONFDIR "/swhoisd.footer" #define MAX_HANDLE 254 +#define MINIMUM_REQUEST_LENGTH 3 #include "config.h" @@ -475,6 +476,14 @@ strip_newline(client_input); lowercase_string(client_input); +#if ! defined WILDCARD_SEARCH_ALLOWED + if ((strlen(client_input) < MINIMUM_REQUEST_LENGTH)) { + (void) fprintf(out_fd, _("Request is too short"), SWHOISD_CONF); + (void) fputs("\r\n\r\n", out_fd); /* '\r' can't be in gettext */ + return (-1); + } +#endif + /* Open database file for searching */ db_fp = fopen(SWHOISD_CONF, "r"); if (db_fp == NULL) {