]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virt-login-shell: correctly calculate string length
authorJán Tomko <jtomko@redhat.com>
Sun, 2 Aug 2020 12:58:38 +0000 (14:58 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 3 Aug 2020 13:37:35 +0000 (15:37 +0200)
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>
tools/virt-login-shell-helper.c

index d9db883ee63bc6bc4e1160846fa6053172c0475e..2db349754ed8f70b1eac44cebfc69eac033e11ad 100644 (file)
@@ -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;
 }