Hello,

enclosed is a patch that prevents tar from dereferencing NULL with
--listed-incremental.  The bug was introduced in 2b1bffb.  Original bug 
report, including a reproducer and backtrace, is located in our bugzilla:

https://bugzilla.redhat.com/635318

I must admit I don't understand much the code, but the attached patch at least 
solves the reported crash.  Thanks in advance for review!

Kamil
From 0d96d7d41737f8a92484ec9afef0c430fdc07e0a Mon Sep 17 00:00:00 2001
From: Kamil Dudka <[email protected]>
Date: Mon, 20 Sep 2010 09:41:08 +0200
Subject: [PATCH] tar: do not crash with --listed-incremental

originally reported at https://bugzilla.redhat.com/635318
* src/incremen.c (append_incremental_renames): Avoid invalid dereference
in case dir == NULL.
---
 src/incremen.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/incremen.c b/src/incremen.c
index c6d4f4c..2bd3f4d 100644
--- a/src/incremen.c
+++ b/src/incremen.c
@@ -893,8 +893,11 @@ append_incremental_renames (struct directory *dir)
   if (obstack_object_size (&stk) != size)
     {
       obstack_1grow (&stk, 0);
-      dumpdir_free (dir->dump);
-      dir->dump = dumpdir_create (obstack_finish (&stk));
+      if (dir)
+	{
+	  dumpdir_free (dir->dump);
+	  dir->dump = dumpdir_create (obstack_finish (&stk));
+	}
     }
   obstack_free (&stk, NULL);
 }
-- 
1.7.2.3

Reply via email to