Skip to content

libssh2: fix error handling on quote errors - #20883

Closed
bagder wants to merge 4 commits into
masterfrom
bagder/libssh2-return
Closed

bagder wants to merge 4 commits into
masterfrom
bagder/libssh2-return

Conversation

@bagder

@bagder bagder commented Mar 11, 2026

Copy link
Copy Markdown
Member

Previously it lacked the actual return.

Reported-by: m777m0 on hackerone

Follow-up to 578706a

Previously it lacked the actual return.

Reported-by: m777m0 on hackerone

Follow-up to 578706a
@bagder
bagder marked this pull request as ready for review March 11, 2026 07:38
@bagder

bagder commented Mar 11, 2026

Copy link
Copy Markdown
Member Author

@aisle-analyzer augment review

@aisle-research-bot

aisle-research-bot Bot commented Mar 11, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

✅ We scanned this PR and did not find any security vulnerabilities.

Aisle supplements but does not replace security review.


Analyzed PR: #20883 at commit 74a4702

Last updated on: 2026-03-11T07:41:30Z

@augmentcode

augmentcode Bot commented Mar 11, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Fixes SFTP quote-command parsing in the libssh2 backend to correctly propagate errors when unexpected trailing data is present.

Changes: Adds a dedicated quote_error() helper and updates all affected branches to immediately return CURLE_QUOTE_ERROR after freeing quote paths.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

bagder added 2 commits March 11, 2026 08:43
avoid function name prefixed with 'return_'

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes SFTP quote-command error handling in the SSH backends by ensuring the parser actually returns an error when it detects trailing/suspicious data after a command’s arguments, rather than continuing execution after freeing quote-path buffers.

Changes:

  • libssh2 backend: make “suspicious data after the command line” paths return CURLE_QUOTE_ERROR immediately (instead of just calling the helper and continuing).
  • Rename the quote-error helper to quote_error() in both libssh2 and libssh backends, aligning the helper name with the updated control flow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/vssh/libssh2.c Ensures quote-parse “trailing data” errors immediately return CURLE_QUOTE_ERROR and renames the helper to quote_error().
lib/vssh/libssh.c Renames the helper to quote_error() (state-machine path already returned properly).

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

You can also share your feedback on Copilot code review. Take the survey.

@github-actions github-actions Bot added the tests label Mar 11, 2026
@bagder bagder closed this in 53a3b21 Mar 11, 2026
@bagder
bagder deleted the bagder/libssh2-return branch March 11, 2026 10:20
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
Previously it lacked the actual return. libssh.c uses the same function
name.

Verified by test 2007.

Reported-by: m777m0 on hackerone

Follow-up to 578706a

Closes curl#20883
vszakats added a commit to vszakats/curl that referenced this pull request Sep 30, 2026
The hash is not material to the test itself, use the modern alternative
to allow running it with MD5 support disabled.

Ref: curl#23182
Follow-up to 53a3b21 curl#20883
vszakats added a commit that referenced this pull request Sep 30, 2026
The hash is not material to the test itself, use the modern alternative
to allow running it with MD5 support disabled.

Follow-up to a418f3f #23182
Follow-up to 53a3b21 #20883

Closes #23184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants