diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-27 18:37:54 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-27 18:37:54 +0000 |
commit | a39cac680705c1cee788a702d75d40220cd6787e (patch) | |
tree | 345412f86958b2d26e139a60488e2a964c43c269 /usr.sbin/ypbind | |
parent | 0da443db43d46848dc4e28881c0d5f51170dcccb (diff) |
Add missing error check for yp_get_default_domain()
Avoids a crash when no default domain is set.
from hshoexer
ok deraadt who had the same diff
Diffstat (limited to 'usr.sbin/ypbind')
-rw-r--r-- | usr.sbin/ypbind/ypbind.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index 6a1c5d91fcc..6193961f0b7 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypbind.c,v 1.78 2023/03/08 04:43:15 guenther Exp $ */ +/* $OpenBSD: ypbind.c,v 1.79 2023/11/27 18:37:53 tb Exp $ */ /* * Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org> @@ -341,8 +341,7 @@ main(int argc, char *argv[]) DIR *dirp; struct dirent *dent; - yp_get_default_domain(&domain); - if (domain[0] == '\0') { + if (yp_get_default_domain(&domain) != 0 || domain[0] == '\0') { fprintf(stderr, "domainname not set. Aborting.\n"); exit(1); } |