summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-18 15:45:34 -0400
committerJunio C Hamano <gitster@pobox.com>2014-06-20 10:44:44 -0700
commitce2ecf29241ca90655da37918044cbbaff48a2bd (patch)
treed61062d9606c724a4e8ed5e0d8bd1b6a6ffe9de7 /fast-import.c
parentcf4fff579e02d8585d59f6c8739534b7b0d617dd (diff)
downloadgit-ce2ecf29241ca90655da37918044cbbaff48a2bd.tar.gz
apply: use skip_prefix instead of raw addition
A submodule diff generally has content like: -Subproject commit [0-9a-f]{40} +Subproject commit [0-9a-f]{40} When we are using "git apply --index" with a submodule, we first apply the textual diff, and then parse that result to figure out the new sha1. If the diff has bogus input like: -Subproject commit 1234567890123456789012345678901234567890 +bogus we will parse the "bogus" portion. Our parser assumes that the buffer starts with "Subproject commit", and blindly skips past it using strlen(). This can cause us to read random memory after the buffer. This problem was unlikely to have come up in practice (since it requires a malformed diff), and even when it did, we likely noticed the problem anyway as the next operation was to call get_sha1_hex on the random memory. However, we can easily fix it by using skip_prefix to notice the parsing error. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
0 files changed, 0 insertions, 0 deletions