summaryrefslogtreecommitdiffstats
path: root/lib/termtable.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-01-28 21:44:20 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-01-28 21:44:20 +0100
commit0ade23e5752336c4c288dcadc06fc9e4911d3063 (patch)
treeb6b3be54ffddb15177e25d8eaee9df66a18ef046 /lib/termtable.c
parentMerge pull request #3664 from opensourcerouting/yang-embed-extensions (diff)
downloadfrr-0ade23e5752336c4c288dcadc06fc9e4911d3063.tar.xz
frr-0ade23e5752336c4c288dcadc06fc9e4911d3063.zip
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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/termtable.c b/lib/termtable.c
index 4f5f9ff21..01468b820 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;