summaryrefslogtreecommitdiffstats
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-03-03 11:50:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-03-03 11:50:49 +0000
commit0bd8e44683c8ada83b23a5f329ef7adf81779d00 (patch)
tree0e81d29fa8d71ba8e976ee9e2b9fa067f131a209 /roff.c
parent20b0938b1da4fd3f51912c4fff9da73b327b9586 (diff)
downloadmandoc-0bd8e44683c8ada83b23a5f329ef7adf81779d00.tar.gz
Fix previous: do not access the byte before the string if the string
is empty; found by jsg@ with afl(1).
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/roff.c b/roff.c
index 17dd8457..5792eb86 100644
--- a/roff.c
+++ b/roff.c
@@ -1236,7 +1236,7 @@ deroff(char **dest, const struct roff_node *n)
/* Skip trailing backslash. */
sz = strlen(cp);
- if (cp[sz - 1] == '\\')
+ if (sz > 0 && cp[sz - 1] == '\\')
sz--;
/* Skip trailing whitespace. */