diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-08-18 01:03:23 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-08-18 01:03:23 +0000 |
commit | c9a52f5c514aad74ee46b6ee2953f5a4f6f443bb (patch) | |
tree | 5abaefb82780b076868501c19890e067d7e755e9 /usr.bin/mandoc | |
parent | 4151374bb8af329faccd3ea8d9dacdc6be51fe35 (diff) |
Use isascii(3) to make sure we really throw away non-ASCII characters,
because isgraph(3) returns true for some eight-bit characters.
ok kristaps@
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 512581e4e30..976f8de822f 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.43 2010/07/25 18:05:54 schwarze Exp $ */ +/* $Id: main.c,v 1.44 2010/08/18 01:03:22 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> @@ -451,6 +451,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; @@ -493,8 +494,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")) |