зеркало из https://github.com/microsoft/git.git
Off-by-one error in get_path_prefix(), found by Valgrind
[jc: original fix was done by Pavel and this contains improvements by Rene.] Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Acked-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
7fb23e6083
Коммит
17cf250aff
|
@ -168,8 +168,9 @@ static int get_path_prefix(const struct strbuf *path, int maxlen)
|
|||
int i = path->len;
|
||||
if (i > maxlen)
|
||||
i = maxlen;
|
||||
while (i > 0 && path->buf[i] != '/')
|
||||
do {
|
||||
i--;
|
||||
} while (i > 0 && path->buf[i] != '/');
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче