summaryrefslogtreecommitdiffstats
path: root/text-utils/column.c
diff options
context:
space:
mode:
authorKarel Zak2010-11-04 22:22:49 +0100
committerKarel Zak2010-11-04 22:22:49 +0100
commit3f7fc4d43b61e442b81937aa06e079950a8ebb7c (patch)
tree90ef2646f98cc089d72b9fe36f1b43031a18d0bd /text-utils/column.c
parentsys-utils: make use xalloc wrappers (diff)
downloadkernel-qcow2-util-linux-3f7fc4d43b61e442b81937aa06e079950a8ebb7c.tar.gz
kernel-qcow2-util-linux-3f7fc4d43b61e442b81937aa06e079950a8ebb7c.tar.xz
kernel-qcow2-util-linux-3f7fc4d43b61e442b81937aa06e079950a8ebb7c.zip
column: segfault on empty input
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=579955 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r--text-utils/column.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/text-utils/column.c b/text-utils/column.c
index 87a6fc790..5b52339f6 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -308,8 +308,10 @@ maketbl()
for (i = lens[coloff] - t->len[coloff] + 2; i > 0; i--)
putwchar(' ');
}
- fputws(t->list[coloff], stdout);
- putwchar('\n');
+ if (coloff < t->cols) {
+ fputws(t->list[coloff], stdout);
+ putwchar('\n');
+ }
}
}