$NetBSD: patch-ah,v 1.1.1.1 2002/08/06 00:48:14 seb Exp $

--- lib/sshsession/sshunixuser.c.orig	Thu May 16 10:32:17 2002
+++ lib/sshsession/sshunixuser.c
@@ -1854,6 +1854,13 @@ SshGroup *ssh_user_get_groups(SshUser uc
         }
 
       endgrent();
+      /* groups array is assumed to end in a NULL pointer, so make sure we have
+         room for it */
+      if (count >= allocated)
+        {
+          allocated++;
+          groups = ssh_xrealloc(groups, allocated*sizeof(SshGroup));
+        }
       groups[count] = NULL;
       uc->groups = groups;
 #else /* HAVE_GETGRENT */
