summaryrefslogtreecommitdiffstats
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
commit8fe2d373bf66c167c2969bd25aebc11b9d069421 (patch)
tree7642d2b4fd1517acd5fa7f3196559d5135ecb65e
parent78a80ac1decff4e03deb1ef4ca357a8d085b3168 (diff)
downloadmandoc-8fe2d373bf66c167c2969bd25aebc11b9d069421.tar.gz
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@
-rw-r--r--chars.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/chars.c b/chars.c
index b1e7f487..95f0f6e6 100644
--- a/chars.c
+++ b/chars.c
@@ -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);