summaryrefslogtreecommitdiff
path: root/usr.bin/cvs/req.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-07-29 10:38:56 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-07-29 10:38:56 +0000
commitc87c66d277c6e8db11fd4e952c1dd9a3e8640721 (patch)
tree41213ef0e72d57ef416266d0263e9f59a4c599d5 /usr.bin/cvs/req.c
parent6c438554db4c1b392347c9bc8178a1c7654def54 (diff)
don't try to skip over the rootpath in the received directory if the
rootpath is larger. tested by xsa@ a long time ago.
Diffstat (limited to 'usr.bin/cvs/req.c')
-rw-r--r--usr.bin/cvs/req.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c
index 25516171b8c..a3cbd9cf8d7 100644
--- a/usr.bin/cvs/req.c
+++ b/usr.bin/cvs/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.29 2005/07/25 12:13:08 xsa Exp $ */
+/* $OpenBSD: req.c,v 1.30 2005/07/29 10:38:55 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -298,11 +298,14 @@ cvs_req_directory(int reqid, char *line)
/*
* Set repository path.
*/
- s = cvs_req_currentdir + strlen(cvs_req_rootpath) + 1;
- if (s >= (cvs_req_currentdir + dirlen)) {
- cvs_log(LP_ERR, "you're bad, go away");
- return (-1);
- }
+ if (strlen(cvs_req_rootpath) < dirlen) {
+ s = cvs_req_currentdir + strlen(cvs_req_rootpath) + 1;
+ if (s >= (cvs_req_currentdir + dirlen)) {
+ cvs_log(LP_ERR, "you're bad, go away");
+ return (-1);
+ }
+ } else
+ s = cvs_req_currentdir;
if ((repo = strdup(s)) == NULL) {
cvs_log(LP_ERR, "failed to save repository path");