diff options
author | wpaul <wpaul@FreeBSD.org> | 1999-04-14 04:05:59 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1999-04-14 04:05:59 +0000 |
commit | c72e0591e75f91a42a5f0a8ea368f0f1075f2b9f (patch) | |
tree | 098a5dd483be8613988f2e27738e2c9a6bb66243 /usr.sbin/ypserv/yp_dblookup.c | |
parent | 9163a26c66b6d4d84f50f95afc5b41040fdcadf8 (diff) | |
download | FreeBSD-src-c72e0591e75f91a42a5f0a8ea368f0f1075f2b9f.zip FreeBSD-src-c72e0591e75f91a42a5f0a8ea368f0f1075f2b9f.tar.gz |
Close PR #11122: check key length before calling strncmp()
in yp_next_record().
Diffstat (limited to 'usr.sbin/ypserv/yp_dblookup.c')
-rw-r--r-- | usr.sbin/ypserv/yp_dblookup.c | 7 |
1 files changed, 4 insertions, 3 deletions
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 <db.h> @@ -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; |