diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index 9aa5f685c2b5..e01787d4a70b 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $NetBSD: makedbm.c,v 1.20 2004/10/30 16:01:48 dsl Exp $ */ +/* $NetBSD: makedbm.c,v 1.21 2005/06/20 00:08:35 lukem Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -33,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: makedbm.c,v 1.20 2004/10/30 16:01:48 dsl Exp $"); +__RCSID("$NetBSD: makedbm.c,v 1.21 2005/06/20 00:08:35 lukem Exp $"); #endif #include @@ -254,7 +254,7 @@ create_database(char *infile, char *database, char *yp_input_file, err(1, "can't open `%s'", infile); } - if (strlen(database) + strlen(YPDB_SUFFIX) > MAXPATHLEN) + if (strlen(database) + strlen(YPDB_SUFFIX) > (sizeof(db_outfile) - 1)) errx(1, "file name `%s' too long", database); snprintf(db_outfile, sizeof(db_outfile), "%s%s", database, YPDB_SUFFIX); @@ -267,8 +267,8 @@ create_database(char *infile, char *database, char *yp_input_file, /* NOTE: database is now directory where map goes ! */ - if (strlen(database) + strlen(mapname) + - strlen(YPDB_SUFFIX) > MAXPATHLEN) + if (strlen(database) + strlen(mapname) + strlen(YPDB_SUFFIX) > + (sizeof(db_mapname) - 1)) errx(1, "directory name `%s' too long", database); snprintf(db_tempname, sizeof(db_tempname), "%s%s", diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index 13ccdf700df9..ab0e61a08e9f 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkalias.c,v 1.12 2004/10/30 16:01:48 dsl Exp $ */ +/* $NetBSD: mkalias.c,v 1.13 2005/06/20 00:08:35 lukem Exp $ */ /* * Copyright (c) 1997 Mats O Jansson @@ -33,7 +33,7 @@ #include #ifndef lint -__RCSID("$NetBSD: mkalias.c,v 1.12 2004/10/30 16:01:48 dsl Exp $"); +__RCSID("$NetBSD: mkalias.c,v 1.13 2005/06/20 00:08:35 lukem Exp $"); #endif #include @@ -222,7 +222,8 @@ main(int argc, char *argv[]) err(1, "Unable to open input database `%s'", input); if (output != NULL) { - if (strlen(output) + strlen(YPDB_SUFFIX) > MAXPATHLEN) + if (strlen(output) + strlen(YPDB_SUFFIX) > + (sizeof(db_outfile) + 1)) warnx("file name `%s' too long", output); snprintf(db_outfile, sizeof(db_outfile), "%s%s", output, YPDB_SUFFIX); @@ -235,8 +236,8 @@ main(int argc, char *argv[]) /* note: output is now directory where map goes ! */ - if (strlen(output) + strlen(mapname) - + strlen(YPDB_SUFFIX) > MAXPATHLEN) + if (strlen(output) + strlen(mapname) + strlen(YPDB_SUFFIX) > + (sizeof(db_mapname) - 1)) errx(1, "Directory name `%s' too long", output); snprintf(db_tempname, sizeof(db_tempname), "%s%s", output,