diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-12 18:02:20 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-12 18:02:20 +0000 |
commit | 5f8f5dd2e0219fb9c5733ffe933ead27619e6d99 (patch) | |
tree | e87f8b85cc5fb5a09b7b22df80f1a5cff0847030 /roff.c | |
parent | 59750b8006bff16f8ef5203be593021f8301edb3 (diff) | |
download | mandoc-5f8f5dd2e0219fb9c5733ffe933ead27619e6d99.tar.gz |
Skipping all escape sequences at the beginning of strings in deroff()
was too aggressive. There are strings that legitimately begin with
an escape sequence. Only skip leading escape sequences representing
whitespace.
Bug reported by martijn@.
Diffstat (limited to 'roff.c')
-rw-r--r-- | roff.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1223,16 +1223,12 @@ deroff(char **dest, const struct roff_node *n) return; } - /* Skip leading whitespace and escape sequences. */ + /* Skip leading whitespace. */ - cp = n->string; - while (*cp != '\0') { - if ('\\' == *cp) { - cp++; - mandoc_escape((const char **)&cp, NULL, NULL); - } else if (isspace((unsigned char)*cp)) + for (cp = n->string; *cp != '\0'; cp++) { + if (cp[0] == '\\' && strchr(" %&0^|~", cp[1]) != NULL) cp++; - else + else if ( ! isspace((unsigned char)*cp)) break; } |