fetch-pack: fix out-of-bounds buffer offset in get_ack
[gitweb.git] / fetch-pack.c
index 6d8926a5504a6cd93e19860f85d58816bdd5c222..27a3e8036474eb18501a79a053bcba84317f52fe 100644 (file)
@@ -226,6 +226,8 @@ static enum ack_type get_ack(int fd, unsigned char *result_sha1)
                return NAK;
        if (!prefixcmp(line, "ACK ")) {
                if (!get_sha1_hex(line+4, result_sha1)) {
+                       if (len < 45)
+                               return ACK;
                        if (strstr(line+45, "continue"))
                                return ACK_continue;
                        if (strstr(line+45, "common"))