From c9a52f5c514aad74ee46b6ee2953f5a4f6f443bb Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 18 Aug 2010 01:03:23 +0000 Subject: 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@ --- usr.bin/mandoc/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.bin/mandoc') 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 * Copyright (c) 2010 Ingo Schwarze @@ -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")) -- cgit v1.2.3