From 0d115411eb00caf6e21ee72eadcb040f99ed59a6 Mon Sep 17 00:00:00 2001 From: claudio Date: Fri, 3 Dec 2021 12:56:19 +0000 Subject: [PATCH] Apply the same MAX_IP_SIZE limit to ROA files as it is done on certificates. OK job@ tb@ --- usr.sbin/rpki-client/roa.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpki-client/roa.c b/usr.sbin/rpki-client/roa.c index 43920e89232..dab7c88007f 100644 --- a/usr.sbin/rpki-client/roa.c +++ b/usr.sbin/rpki-client/roa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roa.c,v 1.32 2021/11/05 10:50:41 claudio Exp $ */ +/* $OpenBSD: roa.c,v 1.33 2021/12/03 12:56:19 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -180,6 +180,11 @@ roa_parse_ipfam(const ASN1_OCTET_STRING *os, struct parse *p) } /* will be called multiple times so use recallocarray */ + if (p->res->ipsz + sk_ASN1_TYPE_num(sseq) >= MAX_IP_SIZE) { + warnx("%s: too many IPAddress entries: limit %d", + p->fn, MAX_IP_SIZE); + goto out; + } p->res->ips = recallocarray(p->res->ips, p->res->ipsz, p->res->ipsz + sk_ASN1_TYPE_num(sseq), sizeof(struct roa_ip)); if (p->res->ips == NULL) -- 2.20.1