]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib: [tt.c] dereferencing data before a null check [coverity scan]
authorKarel Zak <kzak@redhat.com>
Fri, 11 Mar 2011 14:00:30 +0000 (15:00 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:51:30 +0000 (14:51 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/tt.c

index 3bcdea9e0ce4abf85e5b5fdbc34c5ec6d1d0e678..aa93bf5dc13930e91b5a4517ac5adf30541fb33a 100644 (file)
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -518,7 +518,8 @@ static void print_data(struct tt *tb, struct tt_column *cl, char *data)
 
        /* truncate data */
        if (len > width && (cl->flags & TT_FL_TRUNC)) {
-               len = mbs_truncate(data, width);
+               if (data)
+                       len = mbs_truncate(data, width);
                if (!data || len == (size_t) -1) {
                        len = 0;
                        data = NULL;