Blame SOURCES/tar-1.26-dont-segfault-with-disabled-selinux.patch

9d3903
From b6b3ed1fa4c6de12908a9f01d1689f156c3cd441 Mon Sep 17 00:00:00 2001
9d3903
From: Pavel Raiskup <praiskup@redhat.com>
9d3903
Date: Wed, 1 Jul 2015 12:30:57 +0200
9d3903
Subject: [PATCH] selinux-h: avoid double free after *getfilecon()
9d3903
9d3903
Originally reported by Ben Shelton on bug-tar:
9d3903
http://lists.gnu.org/archive/html/bug-tar/2015-04/msg00009.html
9d3903
9d3903
* lib/getfilecon.c (map_to_failure): Set the already freed '*con'
9d3903
pointer to NULL.  Man getfilecon(3) says that any non-NULL '*con'
9d3903
parameter should be freed by freecon(3) (regardless the return
9d3903
value).
9d3903
---
9d3903
 ChangeLog        | 9 +++++++++
9d3903
 lib/getfilecon.c | 1 +
9d3903
 2 files changed, 10 insertions(+)
9d3903
9d3903
diff --git a/lib/getfilecon.c b/lib/getfilecon.c
9d3903
index 9ac69be..ef6adc8 100644
9d3903
--- a/gnu/getfilecon.c
9d3903
+++ b/gnu/getfilecon.c
9d3903
@@ -57,6 +57,7 @@ map_to_failure (int ret, security_context_t *con)
9d3903
   if (ret == 10 && strcmp (*con, "unlabeled") == 0)
9d3903
     {
9d3903
       freecon (*con);
9d3903
+      *con = NULL;
9d3903
       errno = ENODATA;
9d3903
       return -1;
9d3903
     }
9d3903
-- 
9d3903
2.7.4
9d3903