]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib: fix gcc warning in printf call
authorViktor Szakats <commit@vsz.me>
Wed, 11 Oct 2023 04:02:45 +0000 (04:02 +0000)
committerViktor Szakats <commit@vsz.me>
Fri, 13 Oct 2023 09:19:05 +0000 (09:19 +0000)
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

index c7ba3e20e32c9aa6c03f84c7758dc57f61a5d240..92eebf0d28ecf43e50e6abdd19f7d5293670e2f6 100644 (file)
@@ -693,11 +693,11 @@ evaluate:
   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;
     }