[libvirt] [PATCH 01/17] tools: fix crash in virt-login-shell if config doesn't exist

Daniel P. Berrangé berrange at redhat.com
Thu Aug 1 15:00:03 UTC 2019


If the 'allowed_users' config setting in virt-login-shell.conf
does not exist, we dereference a NULL pointer resulting in a
crash. We should check for this case and thus ensure the user
is denied access gracefully.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 tools/virt-login-shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c
index ee5c04f9c2..b906fa9ed6 100644
--- a/tools/virt-login-shell.c
+++ b/tools/virt-login-shell.c
@@ -54,7 +54,7 @@ static int virLoginShellAllowedUser(virConfPtr conf,
         goto cleanup;
 
 
-    for (entries = users; *entries; entries++) {
+    for (entries = users; entries && *entries; entries++) {
         char *entry = *entries;
         /*
           If string begins with a % this indicates a linux group.
-- 
2.21.0




More information about the libvir-list mailing list