From 27fbb4c1d6315e404b547dd9b50bdecc41a07eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Fri, 28 Jan 2022 20:47:37 +0100 Subject: [PATCH] Fix build issues with GCC 12's -Werror=address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lib/digest-md5/printer.c | 11 +++++------ lib/digest-md5/validate.c | 3 --- 2 files changed, 5 insertions(+), 9 deletions(-) --- a/digest-md5/printer.c +++ b/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) { --- a/digest-md5/validate.c +++ b/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