From nobody  Thu Feb 12 22:31:29 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id WAA01729;
          Thu, 12 Feb 1998 22:31:29 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199802130631.WAA01729@hub.freebsd.org>
Date: Thu, 12 Feb 1998 22:31:29 -0800 (PST)
From: msagre@cactus.fi.uba.ar
To: freebsd-gnats-submit@freebsd.org
Subject: IBCS2 getgroups & ftime emulation
X-Send-Pr-Version: www-1.0

>Number:         5734
>Category:       kern
>Synopsis:       IBCS2 getgroups & ftime emulation
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 12 22:40:01 PST 1998
>Closed-Date:    Sat Feb 14 06:31:39 PST 1998
>Last-Modified:  Sat Feb 14 06:32:01 PST 1998
>Originator:     Miguel Angel Sagreras
>Release:        2.2.5
>Organization:
Universidad de Buenos Aires
>Environment:
FreeBSD viper.fi.uba.ar 2.2.5-RELEASE FreeBSD 2.2.5-RELEASE #0: Wed Feb  4 01:45:17 ART 1998     root@viper.fi.uba.ar:/usr/src/sys/compile/VIPER  i386         
>Description:
This bugs was reported last year.
The patch was put into FreeBSD-current but not into 2.2.5-RELEASE
The patch are same to FreeBSD-current
>How-To-Repeat:

>Fix:
*** ibcs2_xenix.c.org   Tue Feb 10 02:02:12 1998
--- ibcs2_xenix.c       Tue Feb  3 22:57:30 1998
***************
*** 119,125 ****
        int *retval;
  {
        struct timeval tv;
!       struct timeb itb;

        DPRINTF(("IBCS2: 'xenix ftime'\n"));
        microtime(&tv);
--- 119,130 ----
        int *retval;
  {
        struct timeval tv;
!       struct ibcs2_timeb {
!               unsigned long time __attribute__((packed));
!               unsigned short millitm;
!               short timezone;
!               short dstflag ;
!       } itb;

        DPRINTF(("IBCS2: 'xenix ftime'\n"));
        microtime(&tv);
***************
*** 129,135 ****
        itb.dstflag = tz.tz_dsttime != DST_NONE;

        return copyout((caddr_t)&itb, (caddr_t)SCARG(uap, tp),
!                      sizeof(struct timeb));
  }

  int
--- 134,140 ----
        itb.dstflag = tz.tz_dsttime != DST_NONE;

        return copyout((caddr_t)&itb, (caddr_t)SCARG(uap, tp),
!                      sizeof(struct ibcs2_timeb));
  }

  int
*** ibcs2_misc.c.org    Tue Feb 10 02:01:35 1998
--- ibcs2_misc.c        Tue Feb  3 22:57:35 1998
***************
*** 653,662 ****
        if (SCARG(uap, gidsetsize)) {
                SCARG(&sa, gidset) = stackgap_alloc(&sg, NGROUPS_MAX *
                                                    sizeof(gid_t *));
        }
-       iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize)*sizeof(ibcs2_gid_t));
        if (error = getgroups(p, &sa, retval))
                return error;
        for (i = 0, gp = SCARG(&sa, gidset); i < retval[0]; i++)
                iset[i] = (ibcs2_gid_t)*gp++;
        if (retval[0] && (error = copyout((caddr_t)iset,
--- 653,665 ----
        if (SCARG(uap, gidsetsize)) {
                SCARG(&sa, gidset) = stackgap_alloc(&sg, NGROUPS_MAX *
                                                    sizeof(gid_t *));
+               iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) *
+                                     sizeof(ibcs2_gid_t));
        }
        if (error = getgroups(p, &sa, retval))
                return error;
+       if (SCARG(uap, gidsetsize) == 0)
+               return 0;
        for (i = 0, gp = SCARG(&sa, gidset); i < retval[0]; i++)
                iset[i] = (ibcs2_gid_t)*gp++;
        if (retval[0] && (error = copyout((caddr_t)iset,

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Sat Feb 14 06:31:39 PST 1998 
State-Changed-Why:  
Thanks for calling this to our attention - it has been merged! 
>Unformatted:
