From: Kristaps Dzonsons Date: Tue, 25 Nov 2008 12:51:17 +0000 (+0000) Subject: Protection against non-ascii. X-Git-Tag: VERSION_1_0_1~57 X-Git-Url: https://git.cameronkatri.com/mandoc.git/commitdiff_plain/bccf89c05b5b1fce89a6b087e8134d986ccb19c5 Protection against non-ascii. --- diff --git a/libmdocml.c b/libmdocml.c index 42e79584..910f409d 100644 --- a/libmdocml.c +++ b/libmdocml.c @@ -1,4 +1,4 @@ -/* $Id: libmdocml.c,v 1.9 2008/11/24 14:24:55 kristaps Exp $ */ +/* $Id: libmdocml.c,v 1.10 2008/11/25 12:51:17 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -17,6 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ #include +#include #include #include #include @@ -188,6 +189,11 @@ again: return(md_run_leave(args, mbuf, rbuf, 0, p)); for (i = 0; i < sz; i++) { + if ( ! isascii(rbuf->buf[i])) { + warnx("%s: non-ascii char (line %zu, col %zu)", + rbuf->name, rbuf->line, pos); + return(md_run_leave(args, mbuf, rbuf, -1, p)); + } if ('\n' != rbuf->buf[i]) { if (pos < BUFFER_LINE) { /* LINTED */