git: 78c4f821f43d - main - jail: fix crash with startup commands on a jail without name
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Mar 2026 20:27:53 UTC
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);
}