From c28905b5363ded3347a1bf8846c57f0122c6cbfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Sun, 2 Aug 2020 14:58:38 +0200
Subject: [PATCH 043/108] virt-login-shell: correctly calculate string length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

virLoginShellGetShellArgv was not dereferencing the pointer
to the string list containing the shell parameters from the
config file, thus setting some random number as shargvlen.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 740e4d705284ba0598258291c2656f50075486f0
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit d339113ab050107fcc4e2a3e9ab939cd92352efe)
---
 tools/virt-login-shell-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helper.c
index d9db883ee6..2db349754e 100644
--- a/tools/virt-login-shell-helper.c
+++ b/tools/virt-login-shell-helper.c
@@ -104,7 +104,7 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
         (*shargv)[0] = g_strdup("/bin/sh");
         *shargvlen = 1;
     } else {
-        *shargvlen = virStringListLength((const char *const *)shargv);
+        *shargvlen = virStringListLength((const char *const *)*shargv);
     }
     return 0;
 }
-- 
2.33.0

