rwrap: fix warning where %s is always passed a NULL pointer in rwrap_create_fake_uri_rr()
authorStefan Metzmacher <metze@samba.org>
Thu, 19 Mar 2020 08:54:48 +0000 (09:54 +0100)
committerAndreas Schneider <asn@samba.org>
Thu, 19 Mar 2020 16:12:41 +0000 (17:12 +0100)
This happens in Samba's gitlab pipeline on Fedora 30/31:

 [3203/4410] Compiling third_party/resolv_wrapper/resolv_wrapper.c
==> /builds/samba-team/devel/samba/samba-o3.stderr <==
../../third_party/resolv_wrapper/resolv_wrapper.c: In function ‘rwrap_create_fake_uri_rr’:
../../third_party/resolv_wrapper/resolv_wrapper.c:104:33: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  104 | # define RWRAP_LOG(dbglvl, ...) rwrap_log((dbglvl), __func__, __VA_ARGS__)
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/resolv_wrapper/resolv_wrapper.c:340:3: note: in expansion of macro ‘RWRAP_LOG’
  340 |   RWRAP_LOG(RWRAP_LOG_ERROR,
      |   ^~~~~~~~~
../../third_party/resolv_wrapper/resolv_wrapper.c:341:28: note: format string is defined here
  341 |      "Malformed URI entry [%s]\n", value);
      |                            ^~
cc1: all warnings being treated as errors

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/resolv_wrapper.c

index bdf2c4171d6d6fceaec15d21e7089e9e0f2074d1..c88893ef9ec432c3ca641efba7433ddfec321ed5 100644 (file)
@@ -309,7 +309,7 @@ static int rwrap_create_fake_uri_rr(const char *key,
        NEXT_KEY(str_prio, str_weight);
        if (uri == NULL) {
                RWRAP_LOG(RWRAP_LOG_ERROR,
-                         "Malformed URI entry [%s]\n", value);
+                         "Malformed URI entry [<null>]\n");
                return -1;
        }