Skip to content

Conversation

cfc4n
Copy link
Member

@cfc4n cfc4n commented May 29, 2025

fix #784

Key change:

@cfc4n cfc4n requested a review from Copilot May 29, 2025 15:55
@cfc4n cfc4n linked an issue May 29, 2025 that may be closed by this pull request
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents writing an empty TLS decryption secrets block in the savePcapng method by only calling WriteDecryptionSecretsBlock when there is data in masterKeyBuffer.

  • Added a length check around WriteDecryptionSecretsBlock
  • Kept the buffer reset logic after write or skip
Comments suppressed due to low confidence (1)

user/module/probe_pcap.go:158

  • The inline comment references issue #542 but the PR metadata cites #784. Please update the comment to reference the correct issue or remove the outdated issue number.
// reset master key buffer, fix issue #542

Copy link

Failed to generate code suggestions for PR

@dosubot dosubot bot added the 🐞 bug Something isn't working label May 29, 2025
@cfc4n cfc4n requested a review from Copilot May 30, 2025 01:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures the savePcapng method only writes a decryption secrets block when there is data in masterKeyBuffer, preventing empty blocks.

  • Added a check around WriteDecryptionSecretsBlock to skip it if masterKeyBuffer is empty.
  • Retains buffer reset behavior after conditional write.
Comments suppressed due to low confidence (1)

user/module/probe_pcap.go:152

  • Add a unit test case for savePcapng when masterKeyBuffer is empty to confirm that WriteDecryptionSecretsBlock is not called.
if t.masterKeyBuffer.Len() > 0 {

@cfc4n cfc4n merged commit 68ae72f into master May 30, 2025
6 checks passed
@cfc4n cfc4n deleted the zero-byte-tlskeylog branch May 30, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

无效的0字节TLS Key Log写入
1 participant