Skip to content

libtailscale: fix logf and printf format specifiers#764

Merged
nickkhyl merged 1 commit intomainfrom
nickkhyl/fix-format-specifiers
Mar 25, 2026
Merged

libtailscale: fix logf and printf format specifiers#764
nickkhyl merged 1 commit intomainfrom
nickkhyl/fix-format-specifiers

Conversation

@nickkhyl
Copy link
Copy Markdown
Member

Updates #cleanup

Updates #cleanup

Signed-off-by: Nick Khyl <nickk@tailscale.com>
netMon, err := netmon.New(b.bus, logf)
if err != nil {
log.Printf("netmon.New: %w", err)
log.Printf("netmon.New: %v", err)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

%w is used for error wrapping and is only supported by fmt.Errorf.

select {
case logstr := <-onLog:
b.logger.Logf(logstr)
b.logger.Logf("%s", logstr)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should avoid passing arbitrary strings as format strings as they may contain format specifiers.

@nickkhyl nickkhyl requested a review from kari-ts March 25, 2026 01:43
@nickkhyl nickkhyl merged commit c540f4e into main Mar 25, 2026
4 checks passed
@nickkhyl nickkhyl deleted the nickkhyl/fix-format-specifiers branch March 25, 2026 04:04
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