mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Merge pull request #7118 from oliverchang/fix
Fixed a heap-buffer-overflow in the smart_pkt.c:set_data function.
This commit is contained in:
@@ -238,13 +238,13 @@ static int set_data(
|
||||
|
||||
if (strncmp(caps, "object-format=", CONST_STRLEN("object-format=")) == 0)
|
||||
format_str = caps + CONST_STRLEN("object-format=");
|
||||
else if ((format_str = strstr(caps, " object-format=")) != NULL)
|
||||
else if ((format_str = git__memmem(caps, len - (caps - line), " object-format=", CONST_STRLEN(" object-format="))) != NULL)
|
||||
format_str += CONST_STRLEN(" object-format=");
|
||||
}
|
||||
|
||||
if (format_str) {
|
||||
if ((eos = strchr(format_str, ' ')) == NULL)
|
||||
eos = strchr(format_str, '\0');
|
||||
if ((eos = memchr(format_str, ' ', len - (format_str - line))) == NULL)
|
||||
eos = memchr(format_str, '\0', len - (format_str - line));
|
||||
|
||||
GIT_ASSERT(eos);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user