From c72e0591e75f91a42a5f0a8ea368f0f1075f2b9f Mon Sep 17 00:00:00 2001 From: wpaul Date: Wed, 14 Apr 1999 04:05:59 +0000 Subject: Close PR #11122: check key length before calling strncmp() in yp_next_record(). --- usr.sbin/ypserv/yp_dblookup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c index b271497..9983b52 100644 --- a/usr.sbin/ypserv/yp_dblookup.c +++ b/usr.sbin/ypserv/yp_dblookup.c @@ -32,7 +32,7 @@ #ifndef lint static const char rcsid[] = - "$Id: yp_dblookup.c,v 1.1 1997/11/09 20:54:38 wpaul Exp wpaul $"; + "$Id: yp_dblookup.c,v 1.15 1998/02/11 19:15:32 wpaul Exp $"; #endif /* not lint */ #include @@ -615,8 +615,9 @@ int yp_next_record(dbp,key,data,all,allow) if (qhead.cqh_first->dbptr->key == NULL) { #endif (dbp->seq)(dbp,&lkey,&ldata,R_FIRST); - while(strncmp((char *)key->data,lkey.data, - (int)key->size) || key->size != lkey.size) + while (key->size != lkey.size || + strncmp((char *)key->data, lkey.data, + (int)key->size)) if ((dbp->seq)(dbp,&lkey,&ldata,R_NEXT)) { #ifdef DB_CACHE qhead.cqh_first->dbptr->size = 0; -- cgit v1.1