diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-12-19 17:12:04 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-12-19 17:12:04 +0000 |
commit | 6e13fac22eeefb3e711d98236a94e9f7fefb6442 (patch) | |
tree | 1c249dbcaf76173824a51bf1c817fd3490440ca2 /term.h | |
parent | 3e2c5875ed63b44494405e85c9aa899ca0b2c53e (diff) | |
download | mandoc-6e13fac22eeefb3e711d98236a94e9f7fefb6442.tar.gz mandoc-6e13fac22eeefb3e711d98236a94e9f7fefb6442.tar.zst mandoc-6e13fac22eeefb3e711d98236a94e9f7fefb6442.zip |
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.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: term.h,v 1.108 2014/12/02 10:08:06 schwarze Exp $ */ +/* $Id: term.h,v 1.109 2014/12/19 17:12:04 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> @@ -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 *); |