summaryrefslogtreecommitdiff
path: root/usr.sbin/ypserv/common/ypdb.c
diff options
context:
space:
mode:
authorchuck <chuck@cvs.openbsd.org>1996-01-20 00:28:58 +0000
committerchuck <chuck@cvs.openbsd.org>1996-01-20 00:28:58 +0000
commite46df41a7eb1723b800b859e31e5fd0de8946f1a (patch)
tree6b75e0399f5f21793f057c201f6885efaa54bdeb /usr.sbin/ypserv/common/ypdb.c
parent097f1c05a74300c4964d3bd2f52b0302c2eece63 (diff)
cleanup: use snprintf() to prevent buffer overflow
Diffstat (limited to 'usr.sbin/ypserv/common/ypdb.c')
-rw-r--r--usr.sbin/ypserv/common/ypdb.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/ypserv/common/ypdb.c b/usr.sbin/ypserv/common/ypdb.c
index bf50d7c231b..32cfdd03690 100644
--- a/usr.sbin/ypserv/common/ypdb.c
+++ b/usr.sbin/ypserv/common/ypdb.c
@@ -38,7 +38,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ypdb.c,v 1.1 1995/11/01 16:56:16 deraadt Exp $
+ * $Id: ypdb.c,v 1.2 1996/01/20 00:28:57 chuck Exp $
*/
#include <sys/param.h>
@@ -75,8 +75,7 @@ ypdb_open(file, flags, mode)
info.cachesize = NULL;
info.hash = NULL;
info.lorder = 0;
- (void)strcpy(path, file);
- (void)strcat(path, YPDB_SUFFIX);
+ snprintf(path, sizeof(path), "%s%s", file, YPDB_SUFFIX);
return ((DBM *)__hash_open(path, flags, mode, &info, 0));
#else
BTREEINFO info;
@@ -91,8 +90,7 @@ ypdb_open(file, flags, mode)
info.compare = NULL;
info.prefix = NULL;
info.lorder = 0;
- (void)strcpy(path, file);
- (void)strcat(path, YPDB_SUFFIX);
+ snprintf(path, sizeof(path), "%s%s", file, YPDB_SUFFIX);
db = (DBM *)__bt_open(path, flags, mode, &info, 0);
return (db);
#endif