[PATCH] findmnt: always allocate memory for cell value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 misc-utils/findmnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 8861b09..91cc935 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -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) /
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux