Here is a patch to fix a use-after-free bug in libps. The
attachment is the entire output of git format-patch; I think
it's the best I can do when using Gmail to send mail.
From c99837f5874c0983e0bcb1d2704c241d4a2aa10d Mon Sep 17 00:00:00 2001
From: Esa Peuha <[email protected]>
Date: Sat, 27 Feb 2016 09:59:13 +0200
Subject: [PATCH] Fix use-after-free in libps.
* libps/fmt.c (_fmt_create): Free new_fmt->src before new_fmt
if reallocating fields fails.
---
libps/fmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libps/fmt.c b/libps/fmt.c
index 580b097..f914212 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -80,8 +80,8 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs,
if (fields == NULL)
{
- FREE (new_fmt);
FREE (new_fmt->src);
+ FREE (new_fmt);
return ENOMEM;
}
--
2.7.0