From 2a34a72bff1df3952ed484daa5ea57700510c6fe Mon Sep 17 00:00:00 2001
From: Guilhem Moulin <guilhem@fripost.org>
Date: Fri, 7 Aug 2015 23:00:08 +0800
Subject: [PATCH] Fix segfault with restricted authorized_key files without
 forced command

---
 svr-authpubkeyoptions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/svr-authpubkeyoptions.c b/svr-authpubkeyoptions.c
index c296141f..9bdf99d1 100644
--- a/svr-authpubkeyoptions.c
+++ b/svr-authpubkeyoptions.c
@@ -91,7 +91,7 @@ int svr_pubkey_allows_pty() {
 /* Set chansession command to the one forced 
  * by any 'command' public key option. */
 void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
-	if (ses.authstate.pubkey_options) {
+	if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) {
 		if (chansess->cmd) {
 			/* original_command takes ownership */
 			chansess->original_command = chansess->cmd;
-- 
GitLab