diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-06 18:37:34 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-06 18:37:34 +0000 |
commit | ccc85730690610c12755680ddc110bf6bde742cf (patch) | |
tree | db401b70eeaf6420ce5551246e27f1b8393f28bb | |
parent | 1fb6260b95b5d63603b18fce1b7f24f1a0db82b3 (diff) | |
download | mandoc-ccc85730690610c12755680ddc110bf6bde742cf.tar.gz mandoc-ccc85730690610c12755680ddc110bf6bde742cf.tar.zst mandoc-ccc85730690610c12755680ddc110bf6bde742cf.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-- | mandoc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: mandoc.c,v 1.81 2014/07/01 22:37:15 schwarze Exp $ */ +/* $Id: mandoc.c,v 1.82 2014/07/06 18:37:34 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -200,8 +200,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; |