]> git.cameronkatri.com Git - mandoc.git/commitdiff
Added check for graphable characters in initial-line parse for libman and libmdoc...
authorKristaps Dzonsons <kristaps@bsd.lv>
Sat, 22 Aug 2009 08:56:16 +0000 (08:56 +0000)
committerKristaps Dzonsons <kristaps@bsd.lv>
Sat, 22 Aug 2009 08:56:16 +0000 (08:56 +0000)
man.c
mdoc.c

diff --git a/man.c b/man.c
index 8fcb8ef93f180c2704de10da5bfcae6c2f9fe2a8..c503a937128cafd7f777a0bd3ace9f8821fb6d42 100644 (file)
--- 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 e382e6929678eb0a244cbabd33bef237f5bab89e..9b6e67241441b810be1d2b4dcb10dda7aee09e0d 100644 (file)
--- 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;