summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/getlog.c
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-04-16 20:05:06 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-04-16 20:05:06 +0000
commit0e7b2118cbe77c28655ff3e45b9d8a22b724b2ed (patch)
tree0f63bb5cc0b12b02ed73fc66a73bcc7c8c25bc22 /usr.bin/cvs/getlog.c
parent6ea60b1ca8bf98a22c223f177182274b0a6eb78a (diff)
more snprintf return value check; joris ok
Diffstat (limited to 'usr.bin/cvs/getlog.c')
-rw-r--r--usr.bin/cvs/getlog.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index 7be8167733c..ec0bb9d64b6 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getlog.c,v 1.21 2005/04/13 19:44:42 jfb Exp $ */
+/* $OpenBSD: getlog.c,v 1.22 2005/04/16 20:05:05 xsa Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -157,7 +157,7 @@ cvs_getlog_remote(CVSFILE *cf, void *arg)
static int
cvs_getlog_local(CVSFILE *cf, void *arg)
{
- int nrev;
+ int nrev, l;
char rcspath[MAXPATHLEN], numbuf[64];
char *repo;
RCSFILE *rf;
@@ -180,8 +180,13 @@ cvs_getlog_local(CVSFILE *cf, void *arg)
root = CVS_DIR_ROOT(cf);
repo = CVS_DIR_REPO(cf);
- snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s",
+ l = snprintf(rcspath, sizeof(rcspath), "%s/%s/%s%s",
root->cr_dir, repo, CVS_FILE_NAME(cf), RCS_FILE_EXT);
+ if (l == -1 || l >= (int)sizeof(rcspath)) {
+ errno = ENAMETOOLONG;
+ cvs_log(LP_ERRNO, "%s", rcspath);
+ return (-1);
+ }
if (log_rfonly) {
cvs_printf("%s\n", rcspath);