projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7fb23e6
)
Off-by-one error in get_path_prefix(), found by Valgrind
author
Rene Scharfe
<rene.scharfe@lsrfire.ath.cx>
Wed, 7 Jun 2006 18:05:43 +0000
(20:05 +0200)
committer
Junio C Hamano
<junkio@cox.net>
Wed, 7 Jun 2006 18:49:08 +0000
(11:49 -0700)
[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>
builtin-tar-tree.c
patch
|
blob
|
history
diff --git
a/builtin-tar-tree.c
b/builtin-tar-tree.c
index
5f740cf
..
7663b9b
100644
(file)
--- a/
builtin-tar-tree.c
+++ b/
builtin-tar-tree.c
@@
-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;
}