diff options
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | 2006-06-07 20:05:43 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-06-07 11:49:08 -0700 |
commit | 17cf250aff26d3baa6b311a3404f1a932e16cf17 (patch) | |
tree | b69bfe7cb653bb48e36f96bb21f92a382e04aec0 /builtin-tar-tree.c | |
parent | 7fb23e6083dbefa8eb4c554d8b2cd5a6292b2df4 (diff) | |
download | git-17cf250aff26d3baa6b311a3404f1a932e16cf17.tar.gz |
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>
Diffstat (limited to 'builtin-tar-tree.c')
-rw-r--r-- | builtin-tar-tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin-tar-tree.c b/builtin-tar-tree.c index 5f740cf702..7663b9bd8e 100644 --- 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; } |