aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit534f7109d67be81218d79589e38dd8606a7eee5e (patch)
tree69d5cc199040e71bb496cb112ed81f4ecd6ec858 /roff.c
parente0443320f54c8a62a9b68da4d72782b1caca44c6 (diff)
downloadmandoc-534f7109d67be81218d79589e38dd8606a7eee5e.tar.gz
mandoc-534f7109d67be81218d79589e38dd8606a7eee5e.tar.zst
mandoc-534f7109d67be81218d79589e38dd8606a7eee5e.zip
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/roff.c b/roff.c
index ad55d320..a6f27040 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.289 2017/02/17 03:03:03 schwarze Exp $ */
+/* $Id: roff.c,v 1.290 2017/03/03 11:50:49 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -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. */