Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Mar 2026 20:27:53 +0000
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 78c4f821f43d - main - jail: fix crash with startup commands on a jail without name
Message-ID:  <69b47349.3c754.4f134b49@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=78c4f821f43d530ba1f2a6308a64a8483208ebe3

commit 78c4f821f43d530ba1f2a6308a64a8483208ebe3
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-03-13 20:21:26 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-03-13 20:27:39 +0000

    jail: fix crash with startup commands on a jail without name
    
    Jail name is optional, thus don't try setenv(NULL).
    
    Fixes:  d8f021add40c321c4578da55dae52fb93c7ccb5f
---
 usr.sbin/jail/command.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c
index 9da4fe51673a..8a1d281eff4f 100644
--- a/usr.sbin/jail/command.c
+++ b/usr.sbin/jail/command.c
@@ -814,8 +814,8 @@ run_command(struct cfjail *j)
 	if (!injail) {
 		if (string_param(j->intparams[KP_JID]))
 			setenv("JID", string_param(j->intparams[KP_JID]), 1);
-		setenv("JNAME", string_param(j->intparams[KP_NAME]), 1);
-
+		if (string_param(j->intparams[KP_NAME]))
+			setenv("JNAME", string_param(j->intparams[KP_NAME]), 1);
 		path = string_param(j->intparams[KP_PATH]);
 		setenv("JPATH", path ? path : "", 1);
 	}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69b47349.3c754.4f134b49>