]> git.pld-linux.org Git - packages/systemd.git/blame - CVE-2012-1174.patch
- rel 9
[packages/systemd.git] / CVE-2012-1174.patch
CommitLineData
2be4e142
JR
1From 5ebff5337594d690b322078c512eb222d34aaa82 Mon Sep 17 00:00:00 2001
2From: Michal Schmidt <mschmidt@redhat.com>
3Date: Fri, 02 Mar 2012 09:39:10 +0000
4Subject: util: never follow symlinks in rm_rf_children()
5
6The function checks if the entry is a directory before recursing, but
7there is a window between the check and the open, during which the
8directory could be replaced with a symlink.
9
10CVE-2012-1174
11https://bugzilla.redhat.com/show_bug.cgi?id=803358
12---
13diff --git a/src/util.c b/src/util.c
14index 20cbc2b..dfc1dc6 100644
15--- a/src/util.c
16+++ b/src/util.c
17@@ -3593,7 +3593,8 @@ static int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) {
18 if (is_dir) {
19 int subdir_fd;
20
21- if ((subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)) < 0) {
22+ subdir_fd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
23+ if (subdir_fd < 0) {
24 if (ret == 0 && errno != ENOENT)
25 ret = -errno;
26 continue;
27--
28cgit v0.9.0.2-2-gbebe
This page took 0.04365 seconds and 4 git commands to generate.