From nobody Sun Feb 8 20:50:18 2026 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 4f8Khp6KpNz6RkfW for ; Sun, 08 Feb 2026 20:50:18 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f8Khp3vZxz4KTq for ; Sun, 08 Feb 2026 20:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770583818; 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=375XpgQkcS6Unq+J2TXwGkDovXAnZZt4lIJJQcgwWVM=; b=yb/e6yubU/JTN1szjzlgDucBAdRWhMGypQn4e7/okcLq/3hR6ZMPfaMy7yDhu5GJrjtVZR 8aG1FlV32V2+Fbui5vSrjFIoi9Xih96VB4xQiBmx9ukTuHBDSGdA5mJhBsQbfbouqRv2aL XSPQhDMvSagjJQ3tSN92b47bzOffuF0MJV5kQp0Fat/78xM5SbpBwq4KvTG6hRIKw86yRr FTkDIIcXC5OxSjAc1gqkGwgbgYEzSbiclSjmhOqO95MzLMDn/eguiT0v7ch4zZWtPBbwSy eXcYPJRP1rBa4dg9bV0BRKl4DclRCAlH9ix5zpFFj3E5zTbIull2GHwpmxi1NQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770583818; a=rsa-sha256; cv=none; b=nWzMtYl8LjRNIB1AmvmQ3NhAqI2DBqywx4AdSrejn9zQFKNv/7yHLdd3XDaSet4KBxZSkL xb7pXOdeq052fcbW8BGH5Qfhp7N7gw7oMPIbcG9azXlC6Kqoay4Seq4w/pRAkuHc7J3V4F ZQ6VO0/ETdg/HP+GpcyQDzsO4BjiRpoLjqFB++dF30Wayqtlx1lhW+ZC3oDDSV/Lq7B//M DjvQoF8N55I5+BsmyG4YOTHpde3sQXfVYdmuGOuPz0Kra1EZI4BoeV4YATtM8GYTzPfP+Z 2OYO/RQlawhGHlZ8Ac9Hf91KyNlRZolRxZ6bSM9ClXFngqvntShofO6ZmaMUGg== 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=1770583818; 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=375XpgQkcS6Unq+J2TXwGkDovXAnZZt4lIJJQcgwWVM=; b=jDNERCDnJ8Ax9H2DBxQTWjjKfrwUguUjMMfZ7e7Bmdt4nMjRNpdX87fAurfutfZfANOw4f 16l3rRFUULJDe6Jcls4XE40PCZpX6UQKqZ6Pj/nGk8OwNsyaG7HauM6QeItSxbqKZ3FlRY nWVB9s3d80uZ5k7fAA3X/EffI1FPGCSULPnbm/lluliKpBysYXGabgZ44o5h1JHCNG96QF w2DqiZInt24RptsM0hSK5+uM7CIgU9vTRRHEBtiy5JsJ07aEUNoSq2+VxnULrisislp/sq SvB74B6SleaZ9U+opRNuL+oXD2sk87GAHVlhlDIaK95MrAU9idQTNdovvJBayA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f8Khp2hTpz13GK for ; Sun, 08 Feb 2026 20:50:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4075d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 08 Feb 2026 20:50:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jes=C3=BAs?= Daniel Colmenares Oviedo Subject: git: 436af5715cdb - main - flua: Fix SIGSEGV in lua_chown when uid/gid doesn't exist 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: dtxdf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 436af5715cdbea87de53d63fcc3762591d93b028 Auto-Submitted: auto-generated Date: Sun, 08 Feb 2026 20:50:18 +0000 Message-Id: <6988f70a.4075d.c63ae2@gitrepo.freebsd.org> The branch main has been updated by dtxdf: URL: https://cgit.FreeBSD.org/src/commit/?id=436af5715cdbea87de53d63fcc3762591d93b028 commit 436af5715cdbea87de53d63fcc3762591d93b028 Author: Jesús Daniel Colmenares Oviedo AuthorDate: 2026-02-08 20:35:25 +0000 Commit: Jesús Daniel Colmenares Oviedo CommitDate: 2026-02-08 20:35:25 +0000 flua: Fix SIGSEGV in lua_chown when uid/gid doesn't exist When lua_chown is used to call chown(2) internally, it first resolves the user and/or group by calling the getpwnam_r(3) and getgrnam_r(3) functions, respectively. However, although it checks for errors, it does not check when entries are not found (which is not an error), which means that the buffer will be set to NULL, and since lua_chown attempts to access the NULL structure, it will receive a SIGSEGV signal. Reviewed by: imp@ Approved by: imp@ Differential Revision: https://reviews.freebsd.org/D55172 --- libexec/flua/modules/lposix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c index a25e875045a2..57e78adb1488 100644 --- a/libexec/flua/modules/lposix.c +++ b/libexec/flua/modules/lposix.c @@ -100,11 +100,11 @@ lua_chown(lua_State *L) owner = (uid_t)lua_tointeger(L, 2); else if (lua_isstring(L, 2)) { char buf[4096]; - struct passwd passwd, *pwd; + struct passwd passwd, *pwd = NULL; error = getpwnam_r(lua_tostring(L, 2), &passwd, buf, sizeof(buf), &pwd); - if (error == 0) + if (pwd != NULL && error == 0) owner = pwd->pw_uid; else return (luaL_argerror(L, 2, @@ -121,11 +121,11 @@ lua_chown(lua_State *L) group = (gid_t)lua_tointeger(L, 3); else if (lua_isstring(L, 3)) { char buf[4096]; - struct group gr, *grp; + struct group gr, *grp = NULL; error = getgrnam_r(lua_tostring(L, 3), &gr, buf, sizeof(buf), &grp); - if (error == 0) + if (grp != NULL && error == 0) group = grp->gr_gid; else return (luaL_argerror(L, 3,