[Bug 3735] The ngroups variable may be set to a negative value when calling sysconf(_SC_NGROUPS_MAX)

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Thu Sep 12 08:24:53 AEST 2024


https://bugzilla.mindrot.org/show_bug.cgi?id=3735

Darren Tucker <dtucker at dtucker.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at dtucker.net

--- Comment #1 from Darren Tucker <dtucker at dtucker.net> ---
> The ngroups variable can be set to a negative value when calling
> sysconf(_SC_NGROUPS_MAX)

That's true...

> and this value is then used without checking in the xcalloc function 

but that's not true.  It's only ever used to increase ngroups beyond
NGROUPS_MAX.  If the sysconf returns -1, that'll be less than
NGROUPS_MAX and it's not used:

        ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
        ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list