summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-08-18 22:04:32 +0000
committerschwarze <schwarze@openbsd.org>2018-08-18 22:04:32 +0000
commit007a2a0135c89a44d667626f348ce347d203c07d (patch)
tree8fbca0c03e1bbbcf859a2cc31e1da3e610cbbfac
parentsupport the highly surprising escape sequence \# (line continuation (diff)
downloadwireguard-openbsd-007a2a0135c89a44d667626f348ce347d203c07d.tar.xz
wireguard-openbsd-007a2a0135c89a44d667626f348ce347d203c07d.zip
Bugfix: When a line ends with '\ \"', don't strip the trailing space
because that turned it into a bogus line continuation.
-rw-r--r--usr.bin/mandoc/roff.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 1e8b65eaef6..b889e9f4a91 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.206 2018/08/18 21:36:53 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.207 2018/08/18 22:04:32 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -1212,7 +1212,8 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
/* Discard normal comments. */
- while (stesc > start && stesc[-1] == ' ')
+ while (stesc > start && stesc[-1] == ' ' &&
+ (stesc == start + 1 || stesc[-2] != '\\'))
stesc--;
*stesc = '\0';
break;