git: c84d08abf732 - stable/14 - jail: fix crash with startup commands on a jail without name
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Apr 2026 03:49:59 UTC
The branch stable/14 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=c84d08abf732deacf082c228c5dbba2bd37ccae3
commit c84d08abf732deacf082c228c5dbba2bd37ccae3
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-03-13 20:21:26 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-04-23 03:23:13 +0000
jail: fix crash with startup commands on a jail without name
Jail name is optional, thus don't try setenv(NULL).
Fixes: d8f021add40c321c4578da55dae52fb93c7ccb5f
(cherry picked from commit 78c4f821f43d530ba1f2a6308a64a8483208ebe3)
---
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 26eaeca442a9..6c454053f547 100644
--- a/usr.sbin/jail/command.c
+++ b/usr.sbin/jail/command.c
@@ -792,8 +792,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);
}