зеркало из https://github.com/microsoft/git.git
Merge branch 'jm/maint-misc-fix' into maint
* jm/maint-misc-fix: read_gitfile_gently: use ssize_t to hold read result remove tests of always-false condition rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
This commit is contained in:
Коммит
5b42477b59
2
fsck.c
2
fsck.c
|
@ -349,7 +349,7 @@ int fsck_error_function(struct object *obj, int type, const char *fmt, ...)
|
|||
va_list ap;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
strbuf_addf(&sb, "object %s:", obj->sha1?sha1_to_hex(obj->sha1):"(null)");
|
||||
strbuf_addf(&sb, "object %s:", sha1_to_hex(obj->sha1));
|
||||
|
||||
va_start(ap, fmt);
|
||||
strbuf_vaddf(&sb, fmt, ap);
|
||||
|
|
10
rerere.c
10
rerere.c
|
@ -47,8 +47,14 @@ static void read_rr(struct string_list *rr)
|
|||
name = xstrdup(buf);
|
||||
if (fgetc(in) != '\t')
|
||||
die("corrupt MERGE_RR");
|
||||
for (i = 0; i < sizeof(buf) && (buf[i] = fgetc(in)); i++)
|
||||
; /* do nothing */
|
||||
for (i = 0; i < sizeof(buf); i++) {
|
||||
int c = fgetc(in);
|
||||
if (c < 0)
|
||||
die("corrupt MERGE_RR");
|
||||
buf[i] = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
}
|
||||
if (i == sizeof(buf))
|
||||
die("filename too long");
|
||||
string_list_insert(rr, buf)->util = name;
|
||||
|
|
2
setup.c
2
setup.c
|
@ -275,7 +275,7 @@ const char *read_gitfile_gently(const char *path)
|
|||
const char *slash;
|
||||
struct stat st;
|
||||
int fd;
|
||||
size_t len;
|
||||
ssize_t len;
|
||||
|
||||
if (stat(path, &st))
|
||||
return NULL;
|
||||
|
|
|
@ -156,7 +156,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
|
|||
continue;
|
||||
if (!ref->peer_ref)
|
||||
continue;
|
||||
if (!ref->new_sha1 || is_null_sha1(ref->new_sha1))
|
||||
if (is_null_sha1(ref->new_sha1))
|
||||
continue;
|
||||
|
||||
/* Follow symbolic refs (mainly for HEAD). */
|
||||
|
|
Загрузка…
Ссылка в новой задаче