help-gsasl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix build issues with GCC 12's -Werror=address


From: Dirk Müller
Subject: [PATCH] Fix build issues with GCC 12's -Werror=address
Date: Fri, 28 Jan 2022 20:41:13 +0100

GCC 12 is able to detect that if(foo) when foo is a char foo[]
is always true, and hence errors out:

   printerc:336:7: error: the comparison will always evaluate as 'true'
                           for the address of 'response' will never be NULL
   336 |   if (r->response)
       |       ^
   In file included from printer.h:27,
                    from printer.c:28:
   tokens.h:139:8: note: 'response' declared here
   139 |   char response[DIGEST_MD5_RESPONSE_LENGTH + 1];
       |        ^~~~~~~~

We can just remove those conditions.

Signed-off-by: Dirk Müller <dirk@dmllr.de>
---
 lib/digest-md5/printer.c  | 11 +++++------
 lib/digest-md5/validate.c |  3 ---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/lib/digest-md5/printer.c b/lib/digest-md5/printer.c
index eddc8e7f..c35c5be3 100644
--- a/lib/digest-md5/printer.c
+++ b/lib/digest-md5/printer.c
@@ -333,12 +333,11 @@ digest_md5_print_response (digest_md5_response * r)
        return NULL;
       }
 
-  if (r->response)
-    if (comma_append (&out, "response", r->response, 0) < 0)
-      {
-       free (out);
-       return NULL;
-      }
+  if (comma_append (&out, "response", r->response, 0) < 0)
+    {
+      free (out);
+      return NULL;
+    }
 
   if (r->clientmaxbuf)
     {
diff --git a/lib/digest-md5/validate.c b/lib/digest-md5/validate.c
index d3caa11d..f7188709 100644
--- a/lib/digest-md5/validate.c
+++ b/lib/digest-md5/validate.c
@@ -102,9 +102,6 @@ digest_md5_validate_response (digest_md5_response * r)
 int
 digest_md5_validate_finish (digest_md5_finish * f)
 {
-  if (!f->rspauth)
-    return -1;
-
   /* A string of 32 hex digits */
   if (strlen (f->rspauth) != DIGEST_MD5_RESPONSE_LENGTH)
     return -1;
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]