summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/commit.c
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-04-15 14:34:16 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-04-15 14:34:16 +0000
commitcadd396a1affc48e3b21b474cc67cdbae1da3fbd (patch)
treeb3d35d48a157b8775d43702cfa19fdcd9f2fa0b0 /usr.bin/cvs/commit.c
parent27a736a9748389af2f1280bd526fec515343bcf6 (diff)
snprintf() return values checks; joris ok
Diffstat (limited to 'usr.bin/cvs/commit.c')
-rw-r--r--usr.bin/cvs/commit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index ea7c55a74e0..1cfad2fbfb9 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.23 2005/04/12 14:58:40 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.24 2005/04/15 14:34:15 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -162,7 +162,7 @@ cvs_commit_prepare(CVSFILE *cf, void *arg)
int
cvs_commit_file(CVSFILE *cf, void *arg)
{
- int ret;
+ int ret, l;
char *repo, rcspath[MAXPATHLEN], fpath[MAXPATHLEN];
RCSFILE *rf;
struct cvsroot *root;
@@ -212,8 +212,13 @@ cvs_commit_file(CVSFILE *cf, void *arg)
}
}
- snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s",
+ l = snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s",
root->cr_dir, repo, fpath, RCS_FILE_EXT);
+ if (l == -1 || l >= (int)sizeof(rcspath)) {
+ errno = ENAMETOOLONG;
+ cvs_log(LP_ERRNO, "%s", rcspath);
+ return (-1);
+ }
cvs_ent_free(entp);