Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ugly way of creating temp directory #109

Open
bigon opened this issue Mar 21, 2020 · 1 comment
Open

Ugly way of creating temp directory #109

bigon opened this issue Mar 21, 2020 · 1 comment

Comments

@bigon
Copy link
Contributor

bigon commented Mar 21, 2020

Hey,

Looking at https://github.com/hughsie/colord/blob/master/lib/colord/cd-test-private.c#L2010, I see the following code

        /* create test directory */
        root = g_strdup_printf ("/tmp/colord-%c%c%c%c",
                                g_random_int_range ('a', 'z'),
                                g_random_int_range ('a', 'z'),
                                g_random_int_range ('a', 'z'),
                                g_random_int_range ('a', 'z'));
        rc = g_mkdir_with_parents (root, 0777);

Two things

  1. making the directory 0777 is IMHO no nice (and insecure)
  2. Why not use g_dir_make_tmp () or g_get_tmp_dir () so one can override the TMPDIR if needed

There are more occurance of using 0777: https://github.com/hughsie/colord/blob/master/lib/colord/cd-test-private.c#L2058

@hughsie
Copy link
Owner

hughsie commented Mar 21, 2020

Get_tmp_dir would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants