summaryrefslogtreecommitdiffstats
path: root/libmdocml.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-11-25 12:51:17 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-11-25 12:51:17 +0000
commitcd382100edfa7077b2c4d42bae7af355e112d95b (patch)
tree0b40efacdecfcfe85d5474e40781b9386a13f0d6 /libmdocml.c
parent6b6936f94277056de963ce05d2dbd24e55ba6bed (diff)
downloadmandoc-cd382100edfa7077b2c4d42bae7af355e112d95b.tar.gz
Protection against non-ascii.
Diffstat (limited to 'libmdocml.c')
-rw-r--r--libmdocml.c6
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 */