diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-01-28 20:44:20 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-01-28 20:44:20 +0000 |
| commit | 0ade23e5752336c4c288dcadc06fc9e4911d3063 (patch) | |
| tree | b6b3be54ffddb15177e25d8eaee9df66a18ef046 /lib/termtable.c | |
| parent | b539a22f5a58016c9aee82a835a37c31382b50ba (diff) | |
lib: protect termtable from bad fmt string
Termtable can write out-of-bounds if given a format string with too many
column separators.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/termtable.c')
| -rw-r--r-- | lib/termtable.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/termtable.c b/lib/termtable.c index 4f5f9ff218..01468b8203 100644 --- a/lib/termtable.c +++ b/lib/termtable.c @@ -163,7 +163,7 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i, orig = res; - while (res) { + while (res && col < tt->ncols) { section = strsep(&res, "|"); row[col].text = XSTRDUP(MTYPE_TTABLE, section); row[col].style = tt->style.cell; |
