From 354885a08d90e5618481182efb14884e62894da0 Mon Sep 17 00:00:00 2001 From: Andrew Lytvynov Date: Thu, 13 Jul 2023 08:54:29 -0700 Subject: [PATCH] wgengine/netlog: fix nil pointer dereference in logtail (#8598) --- wgengine/netlog/logger.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wgengine/netlog/logger.go b/wgengine/netlog/logger.go index 68a873052..3dd02afb9 100644 --- a/wgengine/netlog/logger.go +++ b/wgengine/netlog/logger.go @@ -101,7 +101,8 @@ func (nl *Logger) Startup(nodeID tailcfg.StableNodeID, nodeLogID, domainLogID lo } // Startup a log stream to Tailscale's logging service. - httpc := &http.Client{Transport: logpolicy.NewLogtailTransport(logtail.DefaultHost, netMon, nl.logger.Logf)} + logf := log.Printf + httpc := &http.Client{Transport: logpolicy.NewLogtailTransport(logtail.DefaultHost, netMon, logf)} if testClient != nil { httpc = testClient } @@ -123,7 +124,7 @@ func (nl *Logger) Startup(nodeID tailcfg.StableNodeID, nodeLogID, domainLogID lo // Include process sequence numbers to identify missing samples. IncludeProcID: true, IncludeProcSequence: true, - }, log.Printf) + }, logf) nl.logger.SetSockstatsLabel(sockstats.LabelNetlogLogger) // Startup a data structure to track per-connection statistics.