diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-03-03 11:49:34 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2017-03-03 11:49:34 +0000 |
commit | 269bd2f115b5698e88c5c222215a84672313df2d (patch) | |
tree | 2cdb7a2d5d99e370575b094af3e36444826dc45f /usr.bin/mandoc/roff.c | |
parent | 12577feb47d5f60606a5660f9056f93ca4578262 (diff) |
Fix previous: do not access the byte before the string if the string
is empty; found by jsg@ with afl(1).
Diffstat (limited to 'usr.bin/mandoc/roff.c')
-rw-r--r-- | usr.bin/mandoc/roff.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 1ba0ed3c510..a61af8a1022 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.161 2017/02/17 03:01:39 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.162 2017/03/03 11:49:33 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> @@ -1234,7 +1234,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. */ |