Re: [PATCH] cygwin: set write permission before unlink
- From
- Christof Krüger <git@christof-krueger.de>
- Date
- Jun 29, 2011, 14:31 UTC
- Message-ID
- <09c0b1900a67bd1f701c0b23954a34ab.squirrel@mail.localhost.li>
- In-Reply-To
- <1309331898-32247-1-git-send-email-rei.thiessen@gmail.com>
Show 7 quoted lines
> +#undef unlink
> +int cygwin_unlink(const char *pathname)
> +{
> + /* "read-only" files can't be unlinked */
> + chmod(pathname, 0666);
> + return unlink(pathname);
> +}I've no idea on how cygwin maps file permissions to the underlying filesystem, but the above raised my attention. Doesn't chmodding the file to 0666 open a small windows where "group" and "other" users have read access to the file? This might be unwanted by the user and could be exploited by some attacker listening for changes on that file. Or am I too paranoid?
Regards, Chris