(Putting my comment into an answer now that the question has been reopened)
POSIX specifies that LOGIN_NAME_MAX must be >= _POSIX_LOGIN_NAME_MAX. _POSIX_LOGIN_NAME_MAX, in turn, is defined to 9. On Linux it seems LOGIN_NAME_MAX is 256.
For groups, I don't think there is anything similar. Some kind of upper bound can be guesstimated via the getgrnam_r() and getgrgid_r() functions, which take a user supplied buffer for the char* entries in struct group. The maximum needed size for this buffer can be retrieved via sysconf(_SC_GETGR_R_SIZE_MAX) or the macro NSS_BUFLEN_GROUP. On Linux, NSS_BUFLEN_GROUP seems to be 1024.