Skip to content

Avoid writing state to non regular files#529

Merged
cgzones merged 2 commits intologrotate:masterfrom
cgzones:open_filetype
Jul 13, 2023
Merged

Avoid writing state to non regular files#529
cgzones merged 2 commits intologrotate:masterfrom
cgzones:open_filetype

Conversation

@cgzones
Copy link
Member

@cgzones cgzones commented Jun 30, 2023

Prevent the usage of non-regular files as state file. The state is not actually written to the file of arbitrary type but a regular temporary one, which gets renamed at the end.
For example an erroneous usage of /dev/zero (instead of /dev/null) leads to a replacement of the character device file /dev/zero by a regular one.

cgzones added 2 commits June 30, 2023 19:17
The entry '.' should always be a directory; be pedantic about it and
open it with the flag O_DIRECTORY.
Prevent the usage of non-regular files as state file.  The state is not
actually written to the file of arbitrary type but a regular temporary
one, which gets renamed at the end.
For example an erroneous usage of /dev/zero (instead of /dev/null) leads
to a replacement of the character device file /dev/zero by a regular
one.
@cgzones cgzones merged commit 3e7b5e4 into logrotate:master Jul 13, 2023
@cgzones cgzones deleted the open_filetype branch July 13, 2023 19:24
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

Successfully merging this pull request may close these issues.

2 participants