aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/chars.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2011-07-31 11:24:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2011-07-31 11:24:39 +0000
commite331ee9112782ba1b7525324d0f910550d88b3b0 (patch)
tree17026ab14a0fad69aac05cf245e9d4c14e474b7b /chars.c
parentdc45d01e3b93c2c2dedc33795c6a00a7a6d71542 (diff)
downloadmandoc-e331ee9112782ba1b7525324d0f910550d88b3b0.tar.gz
mandoc-e331ee9112782ba1b7525324d0f910550d88b3b0.tar.zst
mandoc-e331ee9112782ba1b7525324d0f910550d88b3b0.zip
Regression fixes after merging 1.11.3 to OpenBSD (rev. 1.20):
* Do not pass integers outside the ASCII range to isprint(). * Make sure escaped characters are really printed verbatim when the escape sequence has no special meaning. ok kristaps@
Diffstat (limited to 'chars.c')
-rw-r--r--chars.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/chars.c b/chars.c
index a9f50f82..91db80ef 100644
--- a/chars.c
+++ b/chars.c
@@ -1,4 +1,4 @@
-/* $Id: chars.c,v 1.49 2011/07/22 14:15:15 kristaps Exp $ */
+/* $Id: chars.c,v 1.50 2011/07/31 11:24:39 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -113,7 +113,7 @@ mchars_num2char(const char *p, size_t sz)
if ((i = mandoc_strntoi(p, sz, 10)) < 0)
return('\0');
- return(isprint(i) ? i : '\0');
+ return(i > 0 && i < 256 && isprint(i) ? i : '\0');
}
int
@@ -133,8 +133,10 @@ mchars_spec2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz)
const struct ln *ln;
ln = find(arg, p, sz);
- if (NULL == ln)
+ if (NULL == ln) {
+ *rsz = 1;
return(NULL);
+ }
*rsz = strlen(ln->ascii);
return(ln->ascii);