diff options
author | 2011-05-29 21:26:57 +0000 | |
---|---|---|
committer | 2011-05-29 21:26:57 +0000 | |
commit | 7c32f659a682d27ce13ac2f370c35ed31fdecb42 (patch) | |
tree | 4f5421c96183c14d0b146c8897a23a3e7f134f3f | |
parent | Merge release 1.11.3, almost all code by kristaps@: (diff) | |
download | wireguard-openbsd-7c32f659a682d27ce13ac2f370c35ed31fdecb42.tar.xz wireguard-openbsd-7c32f659a682d27ce13ac2f370c35ed31fdecb42.zip |
Fix two regressions introduced in 1.11.3:
* 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.
-rw-r--r-- | usr.bin/mandoc/chars.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/mandoc/chars.c b/usr.bin/mandoc/chars.c index 7e27a3a8ff5..eb0d2f66f2d 100644 --- a/usr.bin/mandoc/chars.c +++ b/usr.bin/mandoc/chars.c @@ -1,4 +1,4 @@ -/* $Id: chars.c,v 1.19 2011/05/29 21:22:18 schwarze Exp $ */ +/* $Id: chars.c,v 1.20 2011/05/29 21:26:57 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -123,7 +123,7 @@ mchars_num2char(const char *p, size_t sz) if ((i = mandoc_strntou(p, sz, 10)) < 0) return('\0'); - return(isprint(i) ? i : '\0'); + return(i > 0 && i < 256 && isprint(i) ? i : '\0'); } /* @@ -150,8 +150,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); |