git: 588bb16e7bb8 - stable/15 - jail: fix crash with startup commands on a jail without name
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Apr 2026 16:01:38 UTC
The branch stable/15 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=588bb16e7bb842a1ad551c7814eb96978245995a
commit 588bb16e7bb842a1ad551c7814eb96978245995a
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-03-13 20:21:26 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2026-04-22 15:59:32 +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 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);
}