From nobody Thu Jul 04 11:32:32 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WFDym4MRLz5Pt35; Thu, 04 Jul 2024 11:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WFDym3NNYz4GmD; Thu, 4 Jul 2024 11:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720092752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dWDm8Jg/hwgJa9btgsT6hEY0gJL8EAfC4eKmypF2p9E=; b=qiXwJP2rDHeQlh6Nh2X3JfSxZrwh1KoaUCeZjt1gFtmFTnrtld4drqI9+XhldiTmP3twS6 YqrsTC14rBKU819rjoh6mM3r0M+QP4Rz4t5RBHQi3l8dMHVKuuVdz56NP29qcTTuYrj61h gw7BJEbg84B9JOlVAXa1FLfnY1dHAxMYXo1o3Jw4YAy/78+SKhhv5A+gPatrXVxod8VmkG znYV7HmALMEmd+7dGciqf9YFYROxGC0YHWnnDVKseRRW3l3+DFbxVY6r8bjXCAiC+ibhWe pqoI2sXJRS3m9hRgujILOax0vTOe0ps81wOkbRIIe2aY7Eg6NvWOy2X5Os8rng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720092752; a=rsa-sha256; cv=none; b=oYe5K9+K6MPzyh8GoUgiR24+UCQ9CxOyY+VJz/oZkLccsQDnxKa8xIHtRN5s71JpZGJ3d+ yF6qERcTZkIpRXkzwfhynZ2NpMoIpVFFJZRco0gUyz8xJhjmMJDnwbL4hbJQuur9Q5XO3N 81IaT4nOddD/d+RcLG2t3l4M+l32m91abxyUx6ehH0yggYWcOjZbmwk0VH5nUiEW0yK0Hu XVZfVzdXjHh7v4082bEQnP218DNIhFTthSMnaW+vPu12MJEtvAz2vI1hposzbhJ5sHvuVu 9Mm/ZpsJj2ywRThx0zHoXnDQUwuM+hTb0lAfKJUh+qJEgdqe0tbqEFlar8BjDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720092752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dWDm8Jg/hwgJa9btgsT6hEY0gJL8EAfC4eKmypF2p9E=; b=wPd58cowci1Oqz5BevZ/E9bSHeP/MJ4T6MGDgMqiVr+Tu35mUCe0KEm+SUB8P7etOUIOrx lJDQpwEdvCZuzqdOG2/m+jkggv70JXx/BhnZoLK58aUEKZZjD28HUVNfxhIAlTb13/PYuf fKdIzLGKGtVjxnQ5LLP63fIEmq6bRzak/5CoaSlXY2pmSiEtieQH2YjlYTwkchhpRq75IL IrzpJZeAgcvuF+aB8/aNAQaFZ/9N+fr/X/p9TmUOiU8uDenidkLtN6VspDvhrh0twZyDU2 mgN1tT77vTfyQHg1P2Lv3Aey1Yf7l5cgCymaCxNO4hLKvA5GPSLF7CSbA/ANFg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WFDym2xcHz1Bqv; Thu, 4 Jul 2024 11:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 464BWWhk088257; Thu, 4 Jul 2024 11:32:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 464BWW6t088254; Thu, 4 Jul 2024 11:32:32 GMT (envelope-from git) Date: Thu, 4 Jul 2024 11:32:32 GMT Message-Id: <202407041132.464BWW6t088254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: a2e65d45a5c6 - main - dhclient: correct struct ifreq allocation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2e65d45a5c6def93e1bc8652a6fe686a63fbdb8 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=a2e65d45a5c6def93e1bc8652a6fe686a63fbdb8 commit a2e65d45a5c6def93e1bc8652a6fe686a63fbdb8 Author: Brooks Davis AuthorDate: 2024-07-04 11:27:10 +0000 Commit: Brooks Davis CommitDate: 2024-07-04 11:27:10 +0000 dhclient: correct struct ifreq allocation ioctl commands such as BIOCSETIF take a struct ifreq and due to FreeBSD's ioctl implementation copy exactly sizeof(struct ifreq) bytes in so allocate that much space. The over-allocaton was harmless, but useless. Reported by: def Fixes: e2dc8d789f68a dhclient: do not add 0.0.0.0 interface alias. Sponsored by: DARPA, AFRL Reviewed by: def Differential Revision: https://reviews.freebsd.org/D45769 --- sbin/dhclient/dispatch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 310f477f8a4f..3108fe4365d1 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -76,7 +76,6 @@ discover_interfaces(struct interface_info *iface) { struct ifaddrs *ifap, *ifa; struct ifreq *tif; - int len = IFNAMSIZ + sizeof(struct sockaddr_storage); if (getifaddrs(&ifap) != 0) error("getifaddrs failed"); @@ -119,7 +118,7 @@ discover_interfaces(struct interface_info *iface) LLADDR(foo), foo->sdl_alen); } if (!iface->ifp) { - if ((tif = calloc(1, len)) == NULL) + if ((tif = calloc(1, sizeof(struct ifreq))) == NULL) error("no space to remember ifp"); strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); iface->ifp = tif;