From: Theo Buehler Subject: rpki-client: appease gcc To: tech@openbsd.org Date: Thu, 25 Jul 2024 09:35:26 +0200 For a while gcc has been whining about a use of uninitialized. /usr/src/usr.sbin/rpki-client/filemode.c: In function 'proc_filemode': /usr/src/usr.sbin/rpki-client/filemode.c:316:14: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized] 316 | if (a->cert->mft != NULL) | ~^~~~~~ /usr/src/usr.sbin/rpki-client/filemode.c:355:22: note: 'a' was declared here 355 | struct auth *a; | ^ While this is a false positive, this code is tricky enough that this is not entirely obvious. Add initialization and corresponding NULL checks. Also switch order of aia and status since claudio mentioned he'd prefer that. Index: filemode.c =================================================================== RCS file: /cvs/src/usr.sbin/rpki-client/filemode.c,v diff -u -p -r1.47 filemode.c --- filemode.c 17 Jun 2024 18:54:36 -0000 1.47 +++ filemode.c 16 Jul 2024 10:30:45 -0000 @@ -313,7 +313,7 @@ print_signature_path(const char *crl, co { if (crl != NULL) printf("Signature path: %s\n", crl); - if (a->cert->mft != NULL) + if (a != NULL && a->cert != NULL && a->cert->mft != NULL) printf(" %s\n", a->cert->mft); if (aia != NULL) printf(" %s\n", aia); @@ -352,7 +352,7 @@ proc_parser_file(char *file, unsigned ch char *aia = NULL; char *crl_uri = NULL; time_t *expires = NULL, *notafter = NULL; - struct auth *a; + struct auth *a = NULL; struct crl *c; const char *errstr = NULL, *valid; int status = 0; @@ -612,7 +612,7 @@ proc_parser_file(char *file, unsigned ch else { printf("\n"); - if (status && aia != NULL) { + if (aia != NULL && status) { print_signature_path(crl_uri, aia, a); if (expires != NULL) printf("Signature path expires: %s\n",