Skip to content

Conversation

@ejohnstown
Copy link
Contributor

  1. Rewrite GetString() and GetStringAlloc() in terms of GetStringRef().
  2. Change GetStringRef() to allow for 0 length strings.
  3. Update DoChannelRequest() to use GetStringAlloc() when reading the modes from the packet.

Fixes ZD20321.

1. Rewrite GetString() and GetStringAlloc() in terms of GetStringRef().
2. Change GetStringRef() to allow for 0 length strings.
3. Update DoChannelRequest() to use GetStringAlloc() when reading the
   modes from the packet.
@dgarske dgarske merged commit b5c9751 into wolfSSL:master Dec 18, 2025
93 checks passed
@ejohnstown ejohnstown deleted the getstrings branch December 18, 2025 21:55
Copy link

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 refactors string extraction functions to use a common implementation and fixes handling of zero-length strings. The changes consolidate GetString() and GetStringAlloc() to use GetStringRef() as their foundation, update GetStringRef() to properly handle zero-length strings, and modify DoChannelRequest() to use GetStringAlloc() for reading terminal modes.

Key Changes

  • Refactored GetString() and GetStringAlloc() to delegate to GetStringRef() instead of duplicating buffer extraction logic
  • Updated GetStringRef() to handle zero-length strings by setting the pointer to NULL when length is zero
  • Changed DoChannelRequest() to use GetStringAlloc() for terminal modes instead of GetStringRef() followed by manual memory allocation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

4 participants