From 38499062023047df0c2f1e4efbda33c2b5111395 Mon Sep 17 00:00:00 2001
From: tron <tron@NetBSD.org>
Date: Sun, 8 Apr 2001 14:49:32 +0000
Subject: [PATCH] Abort parsing and invoke "nroff" if an unsupported macro is
 found in the description section of an unformatted manual page. While this
 makes the "makewhatis" two times slower in avoids creation of several
 incorrect entries in the "whatis.db" database. This fixes PR bin/12535 by
 Thomas Klausner.

---
 libexec/makewhatis/makewhatis.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libexec/makewhatis/makewhatis.c b/libexec/makewhatis/makewhatis.c
index 73cd56a8c084..056c33771f8f 100644
--- a/libexec/makewhatis/makewhatis.c
+++ b/libexec/makewhatis/makewhatis.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: makewhatis.c,v 1.14 2001/04/08 14:27:50 tron Exp $	*/
+/*	$NetBSD: makewhatis.c,v 1.15 2001/04/08 14:49:32 tron Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1999 The NetBSD Foundation, Inc.\n\
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: makewhatis.c,v 1.14 2001/04/08 14:27:50 tron Exp $");
+__RCSID("$NetBSD: makewhatis.c,v 1.15 2001/04/08 14:49:32 tron Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -688,6 +688,10 @@ parsemanpage(gzFile *in, int defaultsection)
 				if (*ptr == '.') {
 					char	*space;
 
+					if (strncasecmp(ptr, ".Nd", 3) != 0) {
+						free(section);
+						return NULL;
+					}
 					space = findwhitespace(ptr);
 					if (space == NULL)
 						ptr = "";