From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id A906D5A061A for ; Tue, 17 Nov 2026 13:06:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1794917191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEwsHMkWA2EOsCC9t09bJRYmZrR7KthmVS8yNSsXCWw=; b=VkwWCt50ufmjSG5BqJ6zNKHxKHKt1l6tU539LevFpV94caRX4XcOj47c3GmNDXA2EKrwHf TtB+PhSqTYIgcZYzflUUxsudqqdxsGR62iJAfHNYO5RW+T7cOW0/sxZFY9Wr7GS+qc/xJ4 1Ioww7ALF8Kfjbqmx0rG22KwIEXsNT8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-DUiF0Q5rM-WZe5G3BLKaHw-1; Tue, 17 Nov 2026 07:06:29 -0500 X-MC-Unique: DUiF0Q5rM-WZe5G3BLKaHw-1 X-Mimecast-MFC-AGG-ID: DUiF0Q5rM-WZe5G3BLKaHw_1794917189 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E65A619560A6; Tue, 17 Nov 2026 12:06:28 +0000 (UTC) Received: from anskuma-thinkpadp1gen7.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 94C7630000E3; Tue, 17 Nov 2026 12:06:26 +0000 (UTC) From: Anshu Kumari To: sbrivio@redhat.com, passt-dev@passt.top, eonzylakshitha@gmail.com Subject: [PATCH 2/2] dhcp: Add bounds check on DNS search domain option buffer Date: Tue, 17 Nov 2026 17:36:17 +0530 Message-ID: <20261117120617.663503-3-anskuma@redhat.com> In-Reply-To: <20261117120617.663503-1-anskuma@redhat.com> References: <20261117120617.663503-1-anskuma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: FCb1zMzx2JTRnspYnIJycKFFOtx3EqMUsFSl6Kjhjg8_1794917189 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: RJHGEIT53WIGTEXXQFHKGLQNVHZCW7CU X-Message-ID-Hash: RJHGEIT53WIGTEXXQFHKGLQNVHZCW7CU X-MailFrom: anskuma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: anskuma@redhat.com X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add an explicit check that the encoded DNS search domain data does not exceed the capacity of opts[119].s before each memcpy() in opt_set_dns_search(). Reported-by: Lakshitha Perera Signed-off-by: Anshu Kumari --- dhcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dhcp.c b/dhcp.c index de6b133b..81833368 100644 --- a/dhcp.c +++ b/dhcp.c @@ -728,6 +728,9 @@ static void opt_set_dns_search(const struct ctx *c, size_t max_len) if (n >= max_len) break; + if (opts[119].slen + n > sizeof(opts[119].s)) + break; + memcpy(opts[119].s + opts[119].slen, buf, n); opts[119].slen += n; max_len -= n; -- 2.55.0