From c87c66d277c6e8db11fd4e952c1dd9a3e8640721 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Fri, 29 Jul 2005 10:38:56 +0000 Subject: don't try to skip over the rootpath in the received directory if the rootpath is larger. tested by xsa@ a long time ago. --- usr.bin/cvs/req.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'usr.bin/cvs/req.c') 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 * 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"); -- cgit v1.2.3