Commits

Rene Scharfe  committed 17cf250

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>

  • Participants
  • Parent commits 7fb23e6

Comments (0)

Files changed (1)

File builtin-tar-tree.c

 	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;
 }