From: Theo Buehler Subject: rpki-client: bail out on empty manifest fileList To: tech@openbsd.org Date: Mon, 23 Dec 2024 11:03:52 +0100 We bail out later on since we didn't find the required CRL, but before that there is a calloc(1, 0) which we should avoid, so this makes the code more robust. Inspired by FORT's latest DoS pointed out by job. Index: mft.c =================================================================== RCS file: /cvs/src/usr.sbin/rpki-client/mft.c,v diff -u -p -r1.120 mft.c --- mft.c 2 Nov 2024 12:30:28 -0000 1.120 +++ mft.c 22 Dec 2024 14:52:23 -0000 @@ -373,6 +373,10 @@ mft_parse_econtent(const char *fn, struc goto out; } + if (sk_FileAndHash_num(mft_asn1->fileList) <= 0) { + warnx("%s: no files in manifest fileList", fn); + goto out; + } if (sk_FileAndHash_num(mft_asn1->fileList) >= MAX_MANIFEST_ENTRIES) { warnx("%s: %d exceeds manifest entry limit (%d)", fn, sk_FileAndHash_num(mft_asn1->fileList),