From 306b1093e90fc5c427f708f9bc966cebb9751f42 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 2 Dec 1996 21:14:17 +0000 Subject: bail nice --- usr.sbin/ypserv/ypserv/ypserv_db.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ypserv/ypserv/ypserv_db.c b/usr.sbin/ypserv/ypserv/ypserv_db.c index 5b86c22fbec..1d7ef585aca 100644 --- a/usr.sbin/ypserv/ypserv/ypserv_db.c +++ b/usr.sbin/ypserv/ypserv/ypserv_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv_db.c,v 1.8 1996/11/11 17:22:15 niklas Exp $ */ +/* $OpenBSD: ypserv_db.c,v 1.9 1996/12/02 21:14:16 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -34,7 +34,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.8 1996/11/11 17:22:15 niklas Exp $"; +static char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.9 1996/12/02 21:14:16 deraadt Exp $"; #endif /* @@ -117,28 +117,32 @@ yp_private(key,ypprivate) { int result; - if (ypprivate) return (FALSE); + if (ypprivate) + return (FALSE); + + if (key.dsize == 0 || key.dptr == NULL) + return (FALSE); if (key.dsize == YP_LAST_LEN && - strncmp(key.dptr,YP_LAST_KEY,YP_LAST_LEN) == 0) + strncmp(key.dptr,YP_LAST_KEY,YP_LAST_LEN) == 0) return(TRUE); if (key.dsize == YP_INPUT_LEN && - strncmp(key.dptr,YP_INPUT_KEY,YP_INPUT_LEN) == 0) + strncmp(key.dptr,YP_INPUT_KEY,YP_INPUT_LEN) == 0) return(TRUE); if (key.dsize == YP_OUTPUT_LEN && - strncmp(key.dptr,YP_OUTPUT_KEY,YP_OUTPUT_LEN) == 0) + strncmp(key.dptr,YP_OUTPUT_KEY,YP_OUTPUT_LEN) == 0) return(TRUE); if (key.dsize == YP_MASTER_LEN && - strncmp(key.dptr,YP_MASTER_KEY,YP_MASTER_LEN) == 0) + strncmp(key.dptr,YP_MASTER_KEY,YP_MASTER_LEN) == 0) return(TRUE); if (key.dsize == YP_DOMAIN_LEN && - strncmp(key.dptr,YP_DOMAIN_KEY,YP_DOMAIN_LEN) == 0) + strncmp(key.dptr,YP_DOMAIN_KEY,YP_DOMAIN_LEN) == 0) return(TRUE); if (key.dsize == YP_INTERDOMAIN_LEN && - strncmp(key.dptr,YP_INTERDOMAIN_KEY,YP_INTERDOMAIN_LEN) == 0) + strncmp(key.dptr,YP_INTERDOMAIN_KEY,YP_INTERDOMAIN_LEN) == 0) return(TRUE); if (key.dsize == YP_SECURE_LEN && - strncmp(key.dptr,YP_SECURE_KEY,YP_SECURE_LEN) == 0) + strncmp(key.dptr,YP_SECURE_KEY,YP_SECURE_LEN) == 0) return(TRUE); return(FALSE); -- cgit v1.2.3