summaryrefslogtreecommitdiffstats
path: root/mdocterm.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-08 18:02:36 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-08 18:02:36 +0000
commit615c4124c25bfd89a89bc7b14e0fe58520858cb1 (patch)
treecee5dac9bdf6c58e909e7a2179e63627056fd4f6 /mdocterm.c
parent10f09076dfef711681072061a37b30e05dc2ba8e (diff)
downloadmandoc-615c4124c25bfd89a89bc7b14e0fe58520858cb1.tar.gz
Updated manuals.
Added -fign-scope and -fign-escape.
Diffstat (limited to 'mdocterm.c')
-rw-r--r--mdocterm.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/mdocterm.c b/mdocterm.c
index 46702e21..a419880b 100644
--- a/mdocterm.c
+++ b/mdocterm.c
@@ -681,24 +681,34 @@ pescape(struct termp *p, const char *word, size_t *i, size_t len)
{
size_t j;
- (*i)++;
- assert(*i < len);
+ if (++(*i) >= len) {
+ warnx("ignoring bad escape sequence");
+ return;
+ }
if ('(' == word[*i]) {
(*i)++;
- assert(*i + 1 < len);
+ if (*i + 1 >= len) {
+ warnx("ignoring bad escape sequence");
+ return;
+ }
nescape(p, &word[*i], 2);
(*i)++;
return;
} else if ('*' == word[*i]) {
- /* XXX - deprecated! */
(*i)++;
- assert(*i < len);
+ if (*i >= len) {
+ warnx("ignoring bad escape sequence");
+ return;
+ }
switch (word[*i]) {
case ('('):
(*i)++;
- assert(*i + 1 < len);
+ if (*i + 1 >= len) {
+ warnx("ignoring bad escape sequence");
+ return;
+ }
nescape(p, &word[*i], 2);
(*i)++;
return;
@@ -718,7 +728,10 @@ pescape(struct termp *p, const char *word, size_t *i, size_t len)
for (j = 0; word[*i] && ']' != word[*i]; (*i)++, j++)
/* Loop... */ ;
- assert(word[*i]);
+ if (0 == word[*i]) {
+ warnx("ignoring bad escape sequence");
+ return;
+ }
nescape(p, &word[*i - j], j);
}