diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2011-12-16 11:13:55 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-12-19 11:38:35 -0500 |
commit | 69420a154fc9fb8b04f437125a6a0604b26b1292 (patch) | |
tree | 4b8e118a394baa2cc0ceeaeadbd04d12db973ef7 /src/tests/debug-tests.c | |
parent | 05113318e280904f2a1ce3721b8d6504afd7e7df (diff) | |
download | sssd-69420a154fc9fb8b04f437125a6a0604b26b1292.tar.gz sssd-69420a154fc9fb8b04f437125a6a0604b26b1292.tar.xz sssd-69420a154fc9fb8b04f437125a6a0604b26b1292.zip |
Securely set umask when using mkstemp
Coverity 12394, 12395, 12396, 12397 and 12398
Diffstat (limited to 'src/tests/debug-tests.c')
-rw-r--r-- | src/tests/debug-tests.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tests/debug-tests.c b/src/tests/debug-tests.c index 8a338fb5f..40dd2e98b 100644 --- a/src/tests/debug-tests.c +++ b/src/tests/debug-tests.c @@ -191,10 +191,14 @@ int test_helper_debug_check_message(int level, int msgmode) int fd; int ret; int _errno = 0; + mode_t old_umask; FILE *file = NULL; strncpy(filename, "sssd_debug_tests.XXXXXX", 24); + + old_umask = umask(077); fd = mkstemp(filename); + umask(old_umask); if (fd == -1) { _errno = errno; talloc_free(ctx); @@ -331,10 +335,14 @@ int test_helper_debug_is_empty_message(int level, int msgmode) int filesize; int ret; int _errno = 0; + mode_t old_umask; FILE *file; strncpy(filename, "sssd_debug_tests.XXXXXX", 24); + + old_umask = umask(077); fd = mkstemp(filename); + umask(old_umask); if (fd == -1) { return DEBUG_TEST_ERROR; } |