@matheusbsbs / matheus-bagliano / commits / f711ab5470
Fork 0

git-verify-pack: buffer overrun paranoia

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>

Rene Scharfe committed Aug 10, 2006 at 17:02 UTC f711ab5470cd1da7fdafa3b7b5e39015dcfca5ce
1 file changed +9
verify-pack.c
+9
@@ -26,6 +26,15 @@ static int verify_one_pack(const char *path, int verbose)
26 len += 4;
27 }
28
29 + /*
30 + * add_packed_git() uses our buffer (containing "foo.idx") to
31 + * build the pack filename ("foo.pack"). Make sure it fits.
32 + */
33 + if (len + 1 >= PATH_MAX) {
34 + arg[len - 4] = '\0';
35 + return error("name too long: %s.pack", arg);
36 + }
37 +
38 pack = add_packed_git(arg, len, 1);
39 if (!pack)
40 return error("packfile %s not found.", arg);