public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix nisplus-alias compile with gcc7
@ 2016-12-21 22:45 Richard Henderson
  2016-12-21 23:46 ` Joseph Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2016-12-21 22:45 UTC (permalink / raw)
  To: libc-alpha

I think the patch is fairly obvious: return error if there is no
name as opposed to if there isn't.

We follow up this check with various strlen, printf etc.  It's
the latter for which gcc7 mainline warns that we pass NULL to %s,
and with -Werror that gets noticed.


r~


	* nis/nss_nisplus/nisplus-alias.c (_nss_nisplus_getaliasbyname_r):
	Fix test for NULL name.

---
 nis/nss_nisplus/nisplus-alias.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index 7f698b4..cb5acce 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -291,7 +291,7 @@ _nss_nisplus_getaliasbyname_r (const char *name, struct aliasent *alias,
 	return status;
     }
 
-  if (name != NULL)
+  if (name == NULL)
     {
       *errnop = EINVAL;
       return NSS_STATUS_UNAVAIL;
-- 
2.9.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix nisplus-alias compile with gcc7
  2016-12-21 22:45 [PATCH] Fix nisplus-alias compile with gcc7 Richard Henderson
@ 2016-12-21 23:46 ` Joseph Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Myers @ 2016-12-21 23:46 UTC (permalink / raw)
  To: Richard Henderson; +Cc: libc-alpha

On Wed, 21 Dec 2016, Richard Henderson wrote:

> I think the patch is fairly obvious: return error if there is no
> name as opposed to if there isn't.

I've taken this statement of obviousness as consensus to commit my 
(identical) patch 
<https://sourceware.org/ml/libc-alpha/2016-12/msg00771.html>.  Bug 20987 
remains open for the various apparently unbounded stack allocations for 
NIS+.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-21 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-21 22:45 [PATCH] Fix nisplus-alias compile with gcc7 Richard Henderson
2016-12-21 23:46 ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).