From: Karel Zak Date: Mon, 18 Jan 2016 09:47:22 +0000 (+0100) Subject: libsmartcols: don't sort if cmpfunc() is not set X-Git-Tag: v2.28-rc1~192 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8afabdb1fa1388c022101d0a8ab932bcaa3c8e34;p=thirdparty%2Futil-linux.git libsmartcols: don't sort if cmpfunc() is not set Reported-by: Igor Gnatenko --- 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"));