summaryrefslogtreecommitdiffstats
path: root/tdeinit
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2015-12-10 20:43:35 +0100
committerSlávek Banko <slavek.banko@axis.cz>2015-12-10 20:43:35 +0100
commit56eb4ba333989ae3999fa0cb6da01f8817e6121f (patch)
tree857c4b6544184e4bfe7b1d6ad12d005dc03c30e6 /tdeinit
parent7be2f6784dcb70a494fc9eb98da68cf10f8a6edb (diff)
downloadtdelibs-56eb4ba333989ae3999fa0cb6da01f8817e6121f.tar.gz
tdelibs-56eb4ba333989ae3999fa0cb6da01f8817e6121f.zip
Fix security issue CVE-2015-7543
[taken from Debian arts patches]
Diffstat (limited to 'tdeinit')
-rw-r--r--tdeinit/lnusertemp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tdeinit/lnusertemp.c b/tdeinit/lnusertemp.c
index 171107041..5d739f680 100644
--- a/tdeinit/lnusertemp.c
+++ b/tdeinit/lnusertemp.c
@@ -192,7 +192,8 @@ int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname)
if (result == 0) return 0; /* Success */
unlink(kde_tmp_dir);
strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ if (mkdtemp(user_tmp_dir) == NULL)
+ return 1;
return create_link(kde_tmp_dir, user_tmp_dir);
}
if ((result == -1) || (!S_ISLNK(stat_buf.st_mode)))
@@ -218,14 +219,16 @@ int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname)
if (result == 0) return 0; /* Success */
unlink(kde_tmp_dir);
strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ if (mkdtemp(user_tmp_dir) == NULL)
+ return 1;
return create_link(kde_tmp_dir, user_tmp_dir);
}
result = check_tmp_dir(tmp_buf);
if (result == 0) return 0; /* Success */
unlink(kde_tmp_dir);
strncat(user_tmp_dir, "XXXXXX", PATH_MAX - strlen(user_tmp_dir));
- mktemp(user_tmp_dir); /* We want a directory, not a file, so using mkstemp makes no sense and is wrong */
+ if (mkdtemp(user_tmp_dir) == NULL)
+ return 1;
return create_link(kde_tmp_dir, user_tmp_dir);
}