]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: always allocate memory for cell value
authorDave Reisner <dreisner@archlinux.org>
Sat, 28 Sep 2013 22:22:43 +0000 (18:22 -0400)
committerKarel Zak <kzak@redhat.com>
Mon, 30 Sep 2013 11:41:00 +0000 (13:41 +0200)
Since b3386c83fe77, findmnt's output uses TT_FL_FREEDATA, which causes
a crash here when string literal is returned instead of a heap address.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
misc-utils/findmnt.c

index 8861b09bd3d6368e161732cf7c61042315ff790c..91cc9350e088e51955ce3309093ef9919ceb5599 100644 (file)
@@ -469,7 +469,7 @@ static char *get_vfs_attr(struct libmnt_fs *fs, int sizetype)
                break;
        case COL_USEPERC:
                if (buf.f_blocks == 0)
-                       return "-";
+                       return xstrdup("-");
 
                xasprintf(&sizestr, "%.0f%%",
                                (double)(buf.f_blocks - buf.f_bfree) /