Fix a NULL access or use-after-free bug
authorjob <job@openbsd.org>
Fri, 29 Dec 2023 14:35:43 +0000 (14:35 +0000)
committerjob <job@openbsd.org>
Fri, 29 Dec 2023 14:35:43 +0000 (14:35 +0000)
This is a bandaid, the proc_parser_mft() is too complex and needs reworking

OK tb@

usr.sbin/rpki-client/parser.c

index 575e2a9..47dc421 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: parser.c,v 1.104 2023/12/18 23:42:20 job Exp $ */
+/*     $OpenBSD: parser.c,v 1.105 2023/12/29 14:35:43 job Exp $ */
 /*
  * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -394,11 +394,10 @@ proc_parser_mft(struct entity *entp, struct mft **mp, char **crlfile,
                *mp = proc_parser_mft_post(file1, mft1, entp->path, err1,
                    &warned);
                if (*mp == NULL) {
-                       if (mft2 != NULL)
-                               warnx("%s#%s: failed fetch, continuing with #%s"
-                                   " from cache", file1, mft1->seqnum,
-                                   mft2->seqnum);
                        mft1 = NULL;
+                       if (mft2 != NULL)
+                               warnx("%s: failed fetch, continuing with #%s"
+                                   " from cache", file1, mft2->seqnum);
                }
        }