summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2006-05-30 19:30:11 +0000
committerjoris <joris@openbsd.org>2006-05-30 19:30:11 +0000
commit4462ebc9b6ec6e7e5e679b4c704cb1d59db9fb21 (patch)
treeba58e7f711cde3cd624bcd4d44c986f8a3d32886
parentPut ASF/IPMI port 623 into the bad dynamic udp table, because otherwise (diff)
downloadwireguard-openbsd-4462ebc9b6ec6e7e5e679b4c704cb1d59db9fb21.tar.xz
wireguard-openbsd-4462ebc9b6ec6e7e5e679b4c704cb1d59db9fb21.zip
make sure cvs_get_repository_path returns a valid repo name
for the import command.
-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");
+ }
}
}