Skip to content

Fix incorrect I/O log base offsets in logsrvd - #562

Merged
millert merged 1 commit into
sudo-project:mainfrom
Z-Bra0:main
Oct 13, 2026
Merged

millert merged 1 commit into
sudo-project:mainfrom
Z-Bra0:main

Conversation

@Z-Bra0

@Z-Bra0 Z-Bra0 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

logsrvd generates relative log IDs using the length of iolog_base, derived from the configured directory. Path expansion can shorten that directory by collapsing %%, collapsing repeated leading slashes, or removing trailing slashes. This mismatch can produce an incorrect relative path or an out-of-bounds read during log-ID generation.

Stop the base at a directory boundary before the first % escape and normalize its leading and trailing slashes consistently with path expansion. Keep expanded components in the relative log ID so reconnects reconstruct the correct path.

Add regression coverage for literal percent escapes, date and named escapes, repeated slashes, and root directories. Tests verify base extraction, offset bounds, and reconnect path reconstruction.

@millert millert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, you are correct that the existing code doesn't take into account the collapsing of leading '/' characters, "%%" or strftime() escapes. I'm happy to see the tests to go along with it.

@millert
millert merged commit 1e5c89d into sudo-project:main Oct 13, 2026
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