glibc/nis
Joseph Myers f88759ea9b Fix nss_nisplus build with mainline GCC (bug 20978).
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.
2016-12-21 23:44:01 +00:00
..
nss_compat Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss_nis Return proper status from _nss_nis_initgroups_dyn (bug 20262) 2016-06-30 13:55:36 +02:00
nss_nisplus Fix nss_nisplus build with mainline GCC (bug 20978). 2016-12-21 23:44:01 +00:00
rpcsvc Installed-header hygiene (BZ#20366): Simple self-contained fixes. 2016-09-23 08:43:55 -04:00
Depend Update. 1998-11-30 16:42:19 +00:00
libnsl.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Makefile Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_add.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_addmember.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_call.c Suppress GCC 6 warning about ambiguous 'else' with -Wparentheses 2016-04-15 13:30:55 +02:00
nis_callback.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_checkpoint.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_clone_dir.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_clone_obj.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_clone_res.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_creategroup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_defaults.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_destroygroup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_domain_of_r.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_domain_of.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_error.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_error.h * nis/nis_error.c: Remove table of strings. Use position 2006-05-11 20:29:20 +00:00
nis_file.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_findserv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_free.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_getservlist.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_hash.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_intern.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_ismember.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_local_names.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_lookup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_mkdir.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_modify.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_ping.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_print_group_entry.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_print.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_remove.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_removemember.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_rmdir.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_server.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_subr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_table.c Silence some false positive warnings for gcc 4.7 2016-01-21 09:11:17 -05:00
nis_util.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_verifygroup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_xdr.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nis_xdr.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nisplus-parser.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss Implement new mode for NIS passwd.adjunct.byname table. 2010-04-07 07:37:39 -07:00
nss-default.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss-nis.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss-nis.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss-nisplus.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nss-nisplus.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Versions * include/resolv.h: Adjust __libc_res_nquery and __libc_res_nsend 2008-05-10 23:27:39 +00:00
yp_xdr.c Set reasonable limits for xdr_requests. 2013-05-30 22:01:22 -04:00
ypclnt.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ypupdate_xdr.c More copyright changes. 2010-09-01 05:10:04 -07:00