Skip to content

Commit

Permalink
git-verify-pack: buffer overrun paranoia
Browse files Browse the repository at this point in the history
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Rene Scharfe authored and Junio C Hamano committed Aug 10, 2006
1 parent d0d619c commit f711ab5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions verify-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ static int verify_one_pack(const char *path, int verbose)
len += 4;
}

/*
* add_packed_git() uses our buffer (containing "foo.idx") to
* build the pack filename ("foo.pack"). Make sure it fits.
*/
if (len + 1 >= PATH_MAX) {
arg[len - 4] = '\0';
return error("name too long: %s.pack", arg);
}

pack = add_packed_git(arg, len, 1);
if (!pack)
return error("packfile %s not found.", arg);
Expand Down

0 comments on commit f711ab5

Please sign in to comment.