Browse Source

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>
maint
Rene Scharfe 19 years ago committed by Junio C Hamano
parent
commit
17cf250aff
  1. 3
      builtin-tar-tree.c

3
builtin-tar-tree.c

@ -168,8 +168,9 @@ static int get_path_prefix(const struct strbuf *path, int maxlen) @@ -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;
}


Loading…
Cancel
Save