Skip to content

vssh: silence gcc-11 -Wnull-dereference, dedupe CURL_EASY_STR() calls - #22656

Closed
vszakats wants to merge 3 commits into
masterfrom
vsz/vssh-warn
Closed

vszakats wants to merge 3 commits into
masterfrom
vsz/vssh-warn

Conversation

@vszakats

@vszakats vszakats commented Aug 24, 2026

Copy link
Copy Markdown
Member

Silencing:

In file included from libcurl_unity.c:179:
vssh/vssh.c: In function ‘Curl_ssh_setup_pkey.part.0’:
vssh/vssh.c:423:50: error: potential null pointer dereference [-Werror=null-dereference]
  423 |        CURL_EASY_STR(data, STRING_SSH_PUBLIC_KEY)[0]) {
libtool: compile:  gcc -DHAVE_CONFIG_H -I../include -I../lib -I../lib -I. -DBUILDING_LIBCURL -DCURL_STATICLIB -DUNITTESTS -D_GNU_SOURCE -Werror-implicit-functi

Ref: https://app.circleci.com/pipelines/gh/curl/curl/20825/workflows/c3eb591b-5a7d-40da-baa8-d2d9980b0cb2/jobs/181277

Follow-up to c8df3de #22628

@vszakats
vszakats marked this pull request as draft August 24, 2026 09:57
@vszakats vszakats changed the title vssh: try silencing gcc-11 warning -Wnull-dereference vssh: silence gcc-11 -Wnull-dereference Aug 24, 2026
@vszakats
vszakats marked this pull request as ready for review August 24, 2026 10:02
Comment thread lib/vssh/vssh.c Outdated
str = CURL_EASY_STR(data, STRING_SSH_PUBLIC_KEY);
if(str && *str) { /* treat empty string the same way as NULL */
sshc->pub_key = curlx_strdup(
CURL_EASY_STR(data, STRING_SSH_PUBLIC_KEY));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not use str here again?

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.

Good point, no reason, I just missed it.

@vszakats vszakats changed the title vssh: silence gcc-11 -Wnull-dereference vssh: silence gcc-11 -Wnull-dereference, dedupe CURL_EASY_STR() calls Aug 24, 2026

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

Prevents a GCC 11 false-positive null-dereference warning while avoiding repeated string lookups.

Changes:

  • Caches the SSH public-key option.
  • Preserves null and empty-string handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vszakats vszakats closed this in c2676bf Aug 24, 2026
@vszakats
vszakats deleted the vsz/vssh-warn branch August 24, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants