diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2010-08-08 14:45:59 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2010-08-08 14:45:59 +0000 |
commit | 707c79c1b528a7fd9042ccdadadb8154470066e5 (patch) | |
tree | d5d1493da894a8794670afa36526ed49aa269315 /main.c | |
parent | 556aafc9aef6fb2d86a1cc5928f39267b81bc0a8 (diff) | |
download | mandoc-707c79c1b528a7fd9042ccdadadb8154470066e5.tar.gz |
Make sure we really throw away non-ASCII characters.
For example, on OpenBSD without locale settings,
isgraph(3) returns true for some eight-bit characters.
ok kristaps@
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -466,6 +466,7 @@ fdesc(struct curparse *curp) struct buf ln, blk; int i, pos, lnn, lnn_start, with_mmap, of; enum rofferr re; + unsigned char c; struct man *man; struct mdoc *mdoc; struct roff *roff; @@ -508,8 +509,8 @@ fdesc(struct curparse *curp) * writers: use special characters. */ - if ( ! isgraph((u_char)blk.buf[i]) && - ! isblank((u_char)blk.buf[i])) { + c = (unsigned char) blk.buf[i]; + if ( ! (isascii(c) && (isgraph(c) || isblank(c)))) { if ( ! mmsg(MANDOCERR_BADCHAR, curp, lnn_start, pos, "ignoring byte")) |