summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-07-06 18:36:49 +0000
committerschwarze <schwarze@openbsd.org>2014-07-06 18:36:49 +0000
commitea2385f76dcd07f16ccbc8d717da4168f71be5e8 (patch)
tree32ccf3a1b14f3da43eece62605777e463e9f969e
parentint all fields, so calloc can become malloc; ok miod@ (diff)
downloadwireguard-openbsd-ea2385f76dcd07f16ccbc8d717da4168f71be5e8.tar.xz
wireguard-openbsd-ea2385f76dcd07f16ccbc8d717da4168f71be5e8.zip
Fix handling of escape sequences taking numeric arguments.
* Repair detection of invalid delimiters. * Discard the invalid delimiter together with the invalid sequence. Note to self: In general, strchr("\0...", c) is a thoroughly bad idea.
-rw-r--r--usr.bin/mandoc/mandoc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index afd68cd652c..73e11c94b65 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.50 2014/07/01 22:36:35 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.51 2014/07/06 18:36:49 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -196,8 +196,10 @@ mandoc_escape(const char **end, const char **start, int *sz)
case 'v':
/* FALLTHROUGH */
case 'x':
- if (strchr("\0 %&()*+-./0123456789:<=>", **start))
+ if (strchr(" %&()*+-./0123456789:<=>", **start)) {
+ ++*end;
return(ESCAPE_ERROR);
+ }
gly = ESCAPE_IGNORE;
term = **start;
*start = ++*end;