diff options
-rw-r--r-- | chars.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |