Skip to content

Conversation

@stoeckmann
Copy link
Contributor

Make sure that an attacker with sufficient privileges cannot simply create a file with expected temporary name to retrieve content of previous and/or future database.

Not as thoroughly tested as usual, but given that #1485 is basically the same and planned to be added to 4.19.1, this should be investigated as well.

In fact, this one is slightly worse because it affects every database write, even the ones with --prefix which could point into directories which are not as protected as /etc.

Still no serious security issue in my point of view, but better be safe than sorry and protect against it.

@stoeckmann stoeckmann marked this pull request as draft January 11, 2026 15:42
@stoeckmann stoeckmann force-pushed the commonio_exclusive branch 2 times, most recently from 31a3f54 to 718ccee Compare January 11, 2026 15:49
@stoeckmann stoeckmann marked this pull request as ready for review January 11, 2026 16:10
@stoeckmann stoeckmann force-pushed the commonio_exclusive branch 2 times, most recently from 4d9ab38 to 92e2db5 Compare January 11, 2026 22:23
@stoeckmann stoeckmann force-pushed the commonio_exclusive branch 4 times, most recently from e22b9ab to da37106 Compare January 12, 2026 17:40
Copy link
Collaborator

@alejandro-colomar alejandro-colomar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

Reviewed-by: Alejandro Colomar <[email protected]>

FILE *bkfp;
int c;

stprintf_a(tmpf, "%s.cioXXXXXX", name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wish that this and the next stprintf_a also returned an error if

Copy link
Collaborator

@alejandro-colomar alejandro-colomar Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could return -1 if it fails. After all, this function already reports some errors, and this is clearly an error.

It doesn't make sense to keep a file around if it's not even a proper
backup.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Make sure that an attacker with sufficient privileges cannot simply
create a file with expected temporary name to retrieve content of
previous and/or future database.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Make sure that enough bytes exist for file name of temporary file which
is used to construct the next database file.

While at it, use a better variable name.

Signed-off-by: Tobias Stoeckmann <[email protected]>
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.

3 participants