* [PATCH] findmnt: always allocate memory for cell value
@ 2013-09-28 22:22 Dave Reisner
2013-09-30 12:02 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Dave Reisner @ 2013-09-28 22:22 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
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 | 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] findmnt: always allocate memory for cell value
2013-09-28 22:22 [PATCH] findmnt: always allocate memory for cell value Dave Reisner
@ 2013-09-30 12:02 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-09-30 12:02 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux
On Sat, Sep 28, 2013 at 06:22:43PM -0400, Dave Reisner wrote:
> misc-utils/findmnt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-30 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-28 22:22 [PATCH] findmnt: always allocate memory for cell value Dave Reisner
2013-09-30 12:02 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox