summaryrefslogtreecommitdiffstats
path: root/term.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-12-19 17:12:04 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-12-19 17:12:04 +0000
commit04a689795a0d5b44eacb81cb022fc4806f18112d (patch)
treeaf09d99e336491cb6e6ea05052770da18d764972 /term.h
parenta40eca4c1b8dab3da5f695f89a86dcad5b0692b6 (diff)
downloadmandoc-04a689795a0d5b44eacb81cb022fc4806f18112d.tar.gz
Enforcing an arbitrary, implementation dependent, undocumented limit
by calling assert() when valid user input exceeds it is a bad idea. Allocate the terminal font stack dynamically instead of crashing above 10 entries. Issue found by jsg@ with afl.
Diffstat (limited to 'term.h')
-rw-r--r--term.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/term.h b/term.h
index bb3e0574..40f2bcf9 100644
--- a/term.h
+++ b/term.h
@@ -84,7 +84,8 @@ struct termp {
enum termenc enc; /* Type of encoding. */
const struct mchars *symtab; /* Character table. */
enum termfont fontl; /* Last font set. */
- enum termfont fontq[10]; /* Symmetric fonts. */
+ enum termfont *fontq; /* Symmetric fonts. */
+ int fontsz; /* Allocated size of font stack */
int fonti; /* Index of font stack. */
term_margin headf; /* invoked to print head */
term_margin footf; /* invoked to print foot */
@@ -127,11 +128,10 @@ size_t term_vspan(const struct termp *,
size_t term_strlen(const struct termp *, const char *);
size_t term_len(const struct termp *, size_t);
-enum termfont term_fonttop(struct termp *);
-const void *term_fontq(struct termp *);
+const enum termfont *term_fontq(struct termp *);
void term_fontpush(struct termp *, enum termfont);
void term_fontpop(struct termp *);
-void term_fontpopq(struct termp *, const void *);
+void term_fontpopq(struct termp *, const enum termfont *);
void term_fontrepl(struct termp *, enum termfont);
void term_fontlast(struct termp *);