summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-08 15:57:13 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-08 15:57:13 +0000
commitd4ed163570e7213e1f0de67a1a850156e8f27d12 (patch)
tree80810df688dac19b3e351ebeec4a9f56d33b9376
parent38190fdea58c37d982a5618dd5a71902a7ad3bd4 (diff)
skip leading \& and \e in tags
-rw-r--r--usr.bin/mandoc/tag.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c
index 639a9836912..d5af00cd72c 100644
--- a/usr.bin/mandoc/tag.c
+++ b/usr.bin/mandoc/tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.c,v 1.14 2016/11/08 15:27:06 schwarze Exp $ */
+/* $OpenBSD: tag.c,v 1.15 2016/11/08 15:57:12 schwarze Exp $ */
/*
* Copyright (c) 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -128,7 +128,13 @@ tag_put(const char *s, int prio, size_t line)
size_t len;
unsigned int slot;
- if (tag_files.tfd <= 0 || strchr(s, ' ') != NULL)
+ /* Sanity checks. */
+
+ if (tag_files.tfd <= 0)
+ return;
+ if (s[0] == '\\' && (s[1] == '&' || s[1] == 'e'))
+ s += 2;
+ if (*s == '\0' || strchr(s, ' ') != NULL)
return;
slot = ohash_qlookup(&tag_data, s);