diff -ur whois-4.6.9-orig/data.h whois-4.6.9/data.h
--- whois-4.6.9-orig/data.h	2003-09-09 15:51:01.000000000 -0700
+++ whois-4.6.9/data.h	2003-12-28 22:02:32.000000000 -0800
@@ -41,6 +41,7 @@
 
 const char *hide_strings[] = {
     "NOTICE AND TERMS OF USE: You", "Network Solutions reserves",/* VERISIGN */
+    "NOTICE: The expiration date", "Registrars.",               /* crsnic */
     "NOTICE: Access to .ORG WHOIS", "time. By submitting",	/* org */
     "NOTICE: Access to .INFO WHOIS", "time. By submitting",	/* info */
     "This Registry database contains ONLY .EDU", "type: help",	/* edu */
diff -ur whois-4.6.9-orig/whois.c whois-4.6.9/whois.c
--- whois-4.6.9-orig/whois.c	2003-12-01 10:15:18.000000000 -0800
+++ whois-4.6.9/whois.c	2003-12-28 22:01:12.000000000 -0800
@@ -36,10 +36,13 @@
 /* Global variables */
 int sockfd, verb = 0;
 
+#define HIDE_DISABLED	-2
+#define HIDE_UNSTARTED	-1
+
 #ifdef ALWAYS_HIDE_DISCL
-int hide_discl = 0;
+int hide_discl = HIDE_UNSTARTED;
 #else
-int hide_discl = 2;
+int hide_discl = HIDE_DISABLED;
 #endif
 
 char *client_tag = (char *)IDSTRING;
@@ -90,6 +93,7 @@
 	switch (ch) {
 	case 'h':
 	    server = q = malloc(strlen(optarg) + 1);
+	    if (!q) err_sys("malloc");
 	    for (p = optarg; *p && *p != ':'; *q++ = tolower(*p++));
 	    if (*p == ':')
 		port = p + 1;
@@ -98,7 +102,7 @@
 	case 'V':
 	    client_tag = optarg;
 	case 'H':
-	    hide_discl = 0;	/* enable disclaimers hiding */
+	    hide_discl = HIDE_UNSTARTED;	/* enable disclaimers hiding */
 	    break;
 	case 'p':
 	    port = optarg;
@@ -126,6 +130,7 @@
 
     /* On some systems realloc only works on non-NULL buffers */
     qstring = malloc(64);
+    if (!qstring) err_sys("malloc");
     *qstring = '\0';
 
     /* parse other parameters, if any */
@@ -246,7 +251,7 @@
     }
 
     if (getenv("WHOIS_HIDE"))
-	hide_discl = 0;
+	hide_discl = HIDE_UNSTARTED;
 
     p = queryformat(server, fstring, qstring);
     if (verb)
@@ -271,6 +276,7 @@
     FILE *fp;
     char buf[512];
     static const char delim[] = " \t";
+    char * found = NULL;
 #ifdef HAVE_REGEXEC
     regex_t re;
 #endif
@@ -319,7 +325,9 @@
 	i = regexec(&re, s, 0, NULL, 0);
 	if (i == 0) {
 	    regfree(&re);
-	    return strdup(server);
+	    found = strdup(server);
+	    if (!found) err_sys("strdup");
+	    return found;
 	}
 	if (i != REG_NOMATCH) {
 	    char m[1024];
@@ -329,7 +337,9 @@
 	regfree(&re);
 #else
 	if (domcmp(s, pattern))
-	    return strdup(server);
+	    found = strdup(server);
+	    if (!found) err_sys("strdup");
+	    return found;
 #endif
     }
     return NULL;
@@ -427,6 +437,7 @@
     /* +2 for \r\n; +1 for NULL */
     buf = malloc(strlen(flags) + strlen(query) + strlen(client_tag) + 4
 	    + 2 + 1);
+    if (!buf) err_sys("malloc");
     *buf = '\0';
     for (i = 0; ripe_servers[i]; i++)
 	if (strcmp(server, ripe_servers[i]) == 0) {
@@ -466,11 +477,44 @@
     return buf;
 }
 
+/* hiding:
+ *   -2: hidden text finished (HIDE_DISABLED)
+ *   -1: hidden text not seen yet (HIDE_UNSTARTED)
+ *   0+: matched entry in "hide_strings" equal to the value of "hiding"
+ * line: what to check against
+ * returns: TRUE = hide this line, FALSE = display this line
+ */
+int hide_line(int *hiding, char * line) {
+    int i;
+
+    if (!hiding || !line || *hiding <= HIDE_DISABLED) return 0;
+
+    switch (*hiding) {
+    case HIDE_UNSTARTED:
+	/* find a starting line if we can */
+	for (i = 0; hide_strings[i] != NULL; i += 2) {
+	    if (strncmp(line, hide_strings[i], strlen(hide_strings[i]))==0) {
+		*hiding=i;
+		return 1;
+	    }
+	}
+	break;
+    default:
+	if (strncmp(line, hide_strings[*hiding+1], strlen(hide_strings[*hiding+1]))==0) {
+	    *hiding = HIDE_DISABLED;	/* stop hiding */
+	    return 1; /* but this line is still a match, so hide it */
+	}
+    }
+    /* no match, current state depends on *hiding */
+    return (*hiding > HIDE_UNSTARTED);
+}
+
 void do_query(const int sock, const char *query)
 {
     char buf[2000], *p;
     FILE *fi;
-    int i = 0, hide = hide_discl;
+    int i = 0;
+    int hide = hide_discl;
 
     fi = fdopen(sock, "r");
     if (write(sock, query, strlen(query)) < 0)
@@ -480,21 +524,8 @@
 	err_sys("shutdown");
 */
     while (fgets(buf, sizeof(buf), fi)) {
-	if (hide == 1) {
-	    if (strncmp(buf, hide_strings[i+1], strlen(hide_strings[i+1]))==0)
-		hide = 2;	/* stop hiding */
-	    continue;		/* hide this line */
-	}
-	if (hide == 0) {
-	    for (i = 0; hide_strings[i] != NULL; i += 2) {
-		if (strncmp(buf, hide_strings[i], strlen(hide_strings[i]))==0){
-		    hide = 1;	/* start hiding */
-		    break;
-		}
-	    }
-	    if (hide == 1)
-		continue;	/* hide the first line */
-	}
+	if (hide_line(&hide,buf)) continue;
+
 #ifdef EXT_6BONE
 	/* % referto: whois -h whois.arin.net -p 43 as 1 */
 	if (strncmp(buf, "% referto:", 10) == 0) {
@@ -530,8 +561,10 @@
     char *temp, buf[2000], *ret = NULL;
     FILE *fi;
     int state = 0;
+    int hide = hide_discl;
 
     temp = malloc(strlen(query) + 1 + 2 + 1);
+    if (!temp) err_sys("malloc");
     *temp = '=';
     strcpy(temp + 1, query);
     strcat(temp, "\r\n");
@@ -550,6 +583,7 @@
 	    for (p = buf; *p != ':'; p++);	/* skip until colon */
 	    for (p++; *p == ' '; p++);		/* skip colon and spaces */
 	    ret = malloc(strlen(p) + 1);
+    	    if (!ret) err_sys("malloc");
 	    for (q = ret; *p != '\n' && *p != '\r' && *p != ' '; *q++ = *p++)
 		; /*copy data*/
 	    *q = '\0';
@@ -557,8 +591,7 @@
 	}
 	/* the output must not be hidden or no data will be shown for
 	   host records and not-existing domains */
-	/* XXX feel free to send a patch to hide the long disclaimer */
-	fputs(buf, stdout);
+	if (!hide_line(&hide,buf)) fputs(buf, stdout);
     }
     if (ferror(fi))
 	err_sys("fgets");
@@ -572,8 +605,10 @@
     char *temp, buf[2000], *ret = NULL;
     FILE *fi;
     int state = 0;
+    int hide = hide_discl;
 
     temp = malloc(strlen(query) + 5 + 2 + 1);
+    if (!temp) err_sys("malloc");
     strcpy(temp, "FULL ");
     strcat(temp, query);
     strcat(temp, "\r\n");
@@ -595,11 +630,12 @@
 	    for (p++; *p != ':'; p++);		/* skip until 2nd colon */
 	    for (p++; *p == ' '; p++);		/* skip colon and spaces */
 	    ret = malloc(strlen(p) + 1);
+    	    if (!ret) err_sys("malloc");
 	    for (q = ret; *p != '\n' && *p != '\r'; *q++ = *p++); /*copy data*/
 	    *q = '\0';
 	    state = 2;
 	}
-	fputs(buf, stdout);
+	if (!hide_line(&hide,buf)) fputs(buf, stdout);
     }
     if (ferror(fi))
 	err_sys("fgets");
@@ -691,6 +727,7 @@
     char *p, *ret;
 
     ret = strdup(dom);
+    if (!ret) err_sys("strdup");
     for (p = ret; *p; p++); p--;	/* move to the last char */
     for (; *p == '.' || p == ret; p--)	/* eat trailing dots */
 	*p = '\0';
@@ -707,8 +744,9 @@
 
 char *convert_6to4(const char *s)
 {
-    char *new = malloc(sizeof("255.255.255.255"));
     unsigned int a, b;
+    char *new = malloc(sizeof("255.255.255.255"));
+    if (!new) err_sys("malloc");
 
     if (sscanf(s, "2002:%x:%x:", &a, &b) != 2)
 	return (char *) "0.0.0.0";
