f88759ea9b
glibc build with current mainline GCC fails because nis/nss_nisplus/nisplus-alias.c contains code if (name != NULL) { *errnop = EINVAL; return NSS_STATUS_UNAVAIL; } char buf[strlen (name) + 9 + tablename_len]; producing an error about strlen being called on a pointer that is always NULL (and a subsequent use of that pointer with a %s format in snprintf). As Andreas noted, the bogus conditional comes from a 1997 change: - if (name == NULL || strlen(name) > 8) - return NSS_STATUS_NOTFOUND; - else + if (name != NULL || strlen(name) <= 8) So the intention is clearly to return an error for NULL name. This patch duly inverts the sense of the conditional. It fixes the build with GCC mainline, and passes usual glibc testsuite testing for x86_64. However, I have not tried any actual substantive nisplus testing, do not have an environment for such testing, and do not know whether it is possible that strlen (name) or tablename_len might be large so that the VLA for buf is actually a security issue. However, if it is a security issue, there are plenty of other similar instances in the nisplus code (that haven't been hidden by a bogus comparison with NULL) - and nis_table.c:__create_ib_request uses strdupa on the string passed to nis_list, so a local fix in the caller wouldn't suffice anyway (see bug 20987). (Calls to strdupa and other such macros that use alloca must be considered equally questionable regarding stack overflow issues as direct calls to alloca and VLA declarations.) [BZ #20978] * nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r): Compare name == NULL, not name != NULL. |
||
---|---|---|
.. | ||
nss_compat | ||
nss_nis | ||
nss_nisplus | ||
rpcsvc | ||
Depend | ||
libnsl.h | ||
Makefile | ||
nis_add.c | ||
nis_addmember.c | ||
nis_call.c | ||
nis_callback.c | ||
nis_checkpoint.c | ||
nis_clone_dir.c | ||
nis_clone_obj.c | ||
nis_clone_res.c | ||
nis_creategroup.c | ||
nis_defaults.c | ||
nis_destroygroup.c | ||
nis_domain_of_r.c | ||
nis_domain_of.c | ||
nis_error.c | ||
nis_error.h | ||
nis_file.c | ||
nis_findserv.c | ||
nis_free.c | ||
nis_getservlist.c | ||
nis_hash.c | ||
nis_intern.h | ||
nis_ismember.c | ||
nis_local_names.c | ||
nis_lookup.c | ||
nis_mkdir.c | ||
nis_modify.c | ||
nis_ping.c | ||
nis_print_group_entry.c | ||
nis_print.c | ||
nis_remove.c | ||
nis_removemember.c | ||
nis_rmdir.c | ||
nis_server.c | ||
nis_subr.c | ||
nis_table.c | ||
nis_util.c | ||
nis_verifygroup.c | ||
nis_xdr.c | ||
nis_xdr.h | ||
nisplus-parser.h | ||
nss | ||
nss-default.c | ||
nss-nis.c | ||
nss-nis.h | ||
nss-nisplus.c | ||
nss-nisplus.h | ||
Versions | ||
yp_xdr.c | ||
ypclnt.c | ||
ypupdate_xdr.c |