From 8afabdb1fa1388c022101d0a8ab932bcaa3c8e34 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 18 Jan 2016 10:47:22 +0100 Subject: [PATCH] libsmartcols: don't sort if cmpfunc() is not set Reported-by: Igor Gnatenko --- libsmartcols/src/table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c index ca1e64825a..7885ba2499 100644 --- a/libsmartcols/src/table.c +++ b/libsmartcols/src/table.c @@ -1075,7 +1075,7 @@ static int cells_cmp_wrapper(struct list_head *a, struct list_head *b, void *dat */ int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl) { - if (!tb || !cl) + if (!tb || !cl || !cl->cmpfunc) return -EINVAL; DBG(TAB, ul_debugobj(tb, "sorting table")); -- 2.47.2