From 4e57d0f0cb3907a6b65968200292d92c5305a7a6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 11 Oct 2023 04:02:45 +0000 Subject: [PATCH] lib: fix gcc warning in printf call Do not pass NULL to printf %s. Seen with gcc 13.2.0 on Debian: ``` .../curl/lib/connect.c:696:27: warning: '%s' directive argument is null [-Wformat-overflow=] ``` Ref: https://github.com/curl/curl-for-win/actions/runs/6476161689/job/17584426483#step:3:11104 Ref: #10284 Co-authored-by: Jay Satiro Closes #12082 --- lib/connect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index c7ba3e20e32..92eebf0d28e 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -693,11 +693,11 @@ static CURLcode is_connected(struct Curl_cfilter *cf, result = CURLE_COULDNT_CONNECT; for(i = 0; i < sizeof(ctx->baller)/sizeof(ctx->baller[0]); i++) { struct eyeballer *baller = ctx->baller[i]; + if(!baller) + continue; CURL_TRC_CF(data, cf, "%s assess started=%d, result=%d", - baller?baller->name:NULL, - baller?baller->has_started:0, - baller?baller->result:0); - if(baller && baller->has_started && baller->result) { + baller->name, baller->has_started, baller->result); + if(baller->has_started && baller->result) { result = baller->result; break; }