summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2006-05-30 19:30:12 +0000
committerJoris Vink <joris@cvs.openbsd.org>2006-05-30 19:30:12 +0000
commit0c6aace57de57459effc7adbb1ccabe34c6f666e (patch)
treec9cd218d76f3f3819749f28a7b0767f54b69a7d9 /usr.bin/cvs
parent679b20c5c22a2b430a1e88a8825bcfe3e15065e7 (diff)
make sure cvs_get_repository_path returns a valid repo name
for the import command.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/util.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index ab30a455400..94208cece76 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.84 2006/05/30 07:00:30 joris Exp $ */
+/* $OpenBSD: util.c,v 1.85 2006/05/30 19:30:11 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -602,13 +602,20 @@ cvs_get_repository_name(const char *dir, char *dst, size_t len)
if (cvs_cmdop == CVS_OP_IMPORT) {
if (strlcpy(dst, import_repository, len) >= len)
- fatal("cvs_get_repository_name: overflow");
+ fatal("cvs_get_repository_name: truncation");
if (strlcat(dst, "/", len) >= len)
- fatal("cvs_get_repository_name: overflow");
- }
+ fatal("cvs_get_repository_name: truncation");
- if (strlcat(dst, dir, len) >= len)
- fatal("cvs_get_repository_name: overflow");
+ if (strcmp(dir, ".")) {
+ if (strlcat(dst, dir, len) >= len) {
+ fatal("cvs_get_repository_name: "
+ "truncation");
+ }
+ }
+ } else {
+ if (strlcat(dst, dir, len) >= len)
+ fatal("cvs_get_repository_name: truncation");
+ }
}
}