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

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