-/* $OpenBSD: extern.h,v 1.140 2022/05/31 18:41:43 tb Exp $ */
+/* $OpenBSD: extern.h,v 1.141 2022/06/01 10:59:21 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
/* Maximum acceptable file size */
#define MAX_FILE_SIZE 4000000
+/* Maximum number of FileNameAndHash entries per RSC checklist. */
+#define MAX_CHECKLIST_ENTRIES 100000
+
/* Maximum number of FileAndHash entries per manifest. */
#define MAX_MANIFEST_ENTRIES 100000
-/* $OpenBSD: rsc.c,v 1.7 2022/05/31 18:51:35 tb Exp $ */
+/* $OpenBSD: rsc.c,v 1.8 2022/06/01 10:59:21 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2022 Job Snijders <job@fastly.com>
return 0;
}
+ if (sz >= MAX_CHECKLIST_ENTRIES) {
+ warnx("%s: %zu exceeds checklist entry limit (%d)", p->fn, sz,
+ MAX_CHECKLIST_ENTRIES);
+ return 0;
+ }
+
p->res->files = calloc(sz, sizeof(struct rscfile));
if (p->res->files == NULL)
err(1, NULL);