summaryrefslogtreecommitdiff
path: root/debian/patches/0003-trans-fakeroot-fix-error-handling.patch
blob: 2a6bae94cb5414ec878beae6cbea520cafb471da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 8c769b20fdc47d3e943806abe5aa5fe2b517a092 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Mon, 16 Jun 2014 16:50:12 +0200
Subject: [PATCH 3/5] trans/fakeroot: fix error handling

Found using the Clang Static Analyzer.

* trans/fakeroot.c (new_node): Do not leak a pointer to freed memory.
Store NULL at *np instead.  This fixes a node use-after-free in
netfs_S_dir_lookup.
---
 trans/fakeroot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 32a34ec..df2de64 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -119,6 +119,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes,
   mach_port_deallocate (mach_task_self (), nn->idport);
   mach_port_deallocate (mach_task_self (), file);
   free (*np);
+  *np = NULL;
   return err;
 }
 
-- 
2.0.0