diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-11-25 12:51:17 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-11-25 12:51:17 +0000 |
commit | cd382100edfa7077b2c4d42bae7af355e112d95b (patch) | |
tree | 0b40efacdecfcfe85d5474e40781b9386a13f0d6 | |
parent | 6b6936f94277056de963ce05d2dbd24e55ba6bed (diff) | |
download | mandoc-cd382100edfa7077b2c4d42bae7af355e112d95b.tar.gz |
Protection against non-ascii.
-rw-r--r-- | libmdocml.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libmdocml.c b/libmdocml.c index 6fc5d32e..2dfc2797 100644 --- a/libmdocml.c +++ b/libmdocml.c @@ -17,6 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ #include <assert.h> +#include <ctype.h> #include <fcntl.h> #include <err.h> #include <stdio.h> @@ -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 */ |