summaryrefslogtreecommitdiffstats
path: root/mandoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2014-08-18 09:11:47 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2014-08-18 09:11:47 +0000
commita85c2bafa990fdb5b501994d2144372b0a789395 (patch)
tree6519db35d517b758fb45c5ae643f3ccd303cb3d1 /mandoc.c
parent63484eb541a34de6d744faf8b22686be28597c50 (diff)
downloadmandoc-a85c2bafa990fdb5b501994d2144372b0a789395.tar.gz
Fix a corner case where \H<nil> (where <nil> is the \0 character) would
cause mandoc_escape() to read past the end of an allocated string. Found when a script scanning of all Mac OSX manual accidentally also scanned binary (gzip'd) files, discussed with schwarze@ on tech@.
Diffstat (limited to 'mandoc.c')
-rw-r--r--mandoc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mandoc.c b/mandoc.c
index ca9759dc..f454a40e 100644
--- a/mandoc.c
+++ b/mandoc.c
@@ -199,7 +199,8 @@ mandoc_escape(const char **end, const char **start, int *sz)
/* FALLTHROUGH */
case 'x':
if (strchr(" %&()*+-./0123456789:<=>", **start)) {
- ++*end;
+ if ('\0' != **start)
+ ++*end;
return(ESCAPE_ERROR);
}
gly = ESCAPE_IGNORE;