diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-07 13:28:22 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-12-07 13:28:22 +0000 |
commit | 7e80723b6694b50d55e97d55eb55e020ba30d2bc (patch) | |
tree | 9fdfb7daded402db7b07d829c5f0bf44f2ec035a | |
parent | d2a66c6448fec82a2979a3f76acb3b481648fac0 (diff) |
check for cvs_path_cat() return value.
-rw-r--r-- | usr.bin/cvs/entries.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index 563927c75dc..17acd3be5ee 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.63 2006/12/07 10:44:16 xsa Exp $ */ +/* $OpenBSD: entries.c,v 1.64 2006/12/07 13:28:21 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -38,13 +38,22 @@ cvs_ent_open(const char *dir) ep = (CVSENTRIES *)xmalloc(sizeof(*ep)); memset(ep, 0, sizeof(*ep)); - cvs_path_cat(dir, CVS_PATH_ENTRIES, buf, sizeof(buf)); + if (cvs_path_cat(dir, CVS_PATH_ENTRIES, buf, sizeof(buf)) >= + sizeof(buf)) + fatal("cvs_ent_open: truncation"); + ep->cef_path = xstrdup(buf); - cvs_path_cat(dir, CVS_PATH_BACKUPENTRIES, buf, sizeof(buf)); + if (cvs_path_cat(dir, CVS_PATH_BACKUPENTRIES, buf, sizeof(buf)) >= + sizeof(buf)) + fatal("cvs_ent_open: truncation"); + ep->cef_bpath = xstrdup(buf); - cvs_path_cat(dir, CVS_PATH_LOGENTRIES, buf, sizeof(buf)); + if (cvs_path_cat(dir, CVS_PATH_LOGENTRIES, buf, sizeof(buf)) >= + sizeof(buf)) + fatal("cvs_ent_open: truncation"); + ep->cef_lpath = xstrdup(buf); TAILQ_INIT(&(ep->cef_ent)); |