提交 17cf250a 编写于 作者: R Rene Scharfe 提交者: Junio C Hamano

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: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
Acked-by: NPavel Roskin <proski@gnu.org>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 7fb23e60
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册