Skip to contentSkip to conversation

findmnt: always allocate memory for cell value

PATCH Applied Dave Reisner 2 participants 2 messages Sep 28, 2013 – Sep 30, 2013 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 findmnt: always allocate memory for cell value

Since b3386c83fe77, findmnt's output uses TT_FL_FREEDATA, which causes a crash here when string literal is returned instead of a heap address.

---
 misc-utils/findmnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
misc-utils/findmnt.c +1 -1
index 8861b09..91cc935 100644
@@ -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) /
Signature · 1 line
1.8.4
maintainer Applied
#1 lore raw
Quoted 2 lines · Dave Reisner
 misc-utils/findmnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com