aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-22 08:56:16 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-22 08:56:16 +0000
commit4569d232fe6387ebaffede22a904a733d699030f (patch)
treee69803f379ab2e78e77b8c61b4518e386d9aca2b
parent115a33d8b5b4a3cc8361aceda5ad0503ae4d6e42 (diff)
downloadmandoc-4569d232fe6387ebaffede22a904a733d699030f.tar.gz
mandoc-4569d232fe6387ebaffede22a904a733d699030f.tar.zst
mandoc-4569d232fe6387ebaffede22a904a733d699030f.zip
Added check for graphable characters in initial-line parse for libman and libmdoc (joerg@netbsd.org).
-rw-r--r--man.c8
-rw-r--r--mdoc.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/man.c b/man.c
index 8fcb8ef9..c503a937 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.37 2009/08/21 13:45:33 kristaps Exp $ */
+/* $Id: man.c,v 1.38 2009/08/22 08:56:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -493,6 +493,12 @@ man_pmacro(struct man *m, int ln, char *buf)
break;
else if (' ' == buf[i])
break;
+
+ /* Check for invalid characters. */
+
+ if (isgraph((u_char)buf[i]))
+ continue;
+ return(man_perr(m, ln, i, WNPRINT));
}
mac[j] = 0;
diff --git a/mdoc.c b/mdoc.c
index e382e692..9b6e6724 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.103 2009/08/20 11:44:47 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.104 2009/08/22 08:56:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -709,6 +709,12 @@ parsemacro(struct mdoc *m, int ln, char *buf)
break;
else if (' ' == buf[i])
break;
+
+ /* Check for invalid characters. */
+
+ if (isgraph((u_char)buf[i]))
+ continue;
+ return(mdoc_perr(m, ln, i, EPRINT));
}
mac[j] = 0;